// JavaScript Document
function setFlashSize (){
//pone el navegador en tamaño completo
	
// toma el tamaño del navegador
	var myWidth = 0, myHeight = 0;
	if (typeof(window.innerWidth) == 'number'){
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
    }else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
  
	
// seteal el tamaño del flash
	
	fw = Math.max(myWidth,1020)
	fh = Math.max(myHeight,850)
	if(fh==850){
		fw = fw-18;	
	}
	document.getElementById("flashcontent").style.width = fw;
	document.getElementById("flashcontent").style.height = fh;
}

function setFlash(pw, ph){
	document.flashid.width = pw;
	document.flashid.height = ph;
}

function splash () {
	var w = window.screen.width;
	var h = window.screen.height;	
	top.window.resizeTo(w,h);
	top.window.moveTo (4,4);
}


function openWindow(url,name,width,height,leftPos,topPos,scroll,toolbar){
	if(arguments.length == 2) {
		settings="height="+height+",width="+width+",top=0,left=0,scrollbars=1,toolbar=0"
	} else {
		if(leftPos=="c")	leftPos = (screen.width-width)/2
		if(topPos=="c")		topPos = (screen.height-height)/2
		settings="height="+height+",width="+width+",top="+topPos+",left="+leftPos+",scrollbars=1,toolbar="+toolbar+""
	}
	w = window.open(url,name,settings)
	w.focus();
}
		
		
//SOCIAL LINKS

function addToDel(prodId, prodName, page) {
	if (prodId != ""){
		p = page + "?id=" + prodId;
	}else{
		p = page;
	}
	u = encodeURIComponent("http://www.sos-sportswear.com/" + p);
	t = encodeURIComponent("SOS Sportswear | " + prodName);
	str = "http://del.icio.us/post?v=4&noui&jump=close&url=" + u + "&title=" + t
	openWindow(str, "addtodelicious", 700, 400, 0, 0)
}

function addToBlogSpot(prodId, prodName, page) {
	if (prodId != ""){
		p = page + "?id=" + prodId;
	}else{
		p = page;
	}
	u = encodeURIComponent("http://www.sos-sportswear.com/" + p);
	t = encodeURIComponent("SOS Sportswear | " + prodName);
	str = "http://blogger.com/"
	openWindow(str, "addtoblogspot", 800, 400, 0, 0)
}

function addToFaceBook(prodId, prodName, page) {
	if (prodId != ""){
		p = page + "?id=" + prodId;
	}else{
		p = page;
	}
	u = encodeURIComponent("http://www.sos-sportswear.com/" + p);
	t = encodeURIComponent("SOS Sportswear | " + prodName);
	str = "http://www.facebook.com/sharer.php?u=" + u + "&t=" + t
	openWindow(str, "addtofacebook", 626, 436, 0, 0)
}

function addToTwitter(prodId, prodName, page) {
	if (prodId != ""){
		p = page + "?id=" + prodId;
	}else{
		p = page;
	}
	u = encodeURIComponent("http://www.sos-sportswear.com/" + p);
	t = encodeURIComponent("SOS Sportswear | " + prodName);
	str = "http://twitter.com/home?status=" + u
	openWindow(str, "addtodigg", 700, 500, 0, 0)
}


function addToMyspace(prodId, prodName, page) {
	if (prodId != ""){
		p = page + "?id=" + prodId;
	}else{
		p = page;
	}
	u = encodeURIComponent("http://www.sos-sportswear.com/" + p);
	t = encodeURIComponent("SOS Sportswear | " + prodName);
	imppath = ""
	str = "http://www.myspace.com/Modules/PostTo/Pages/?t=" + t + "&u" + u
	openWindow(str, "addtomyspace", 870, 720, 0, 0)
}
