function doTheZoom(id) {
whatSource = document.mainpic.src;
if (whatSource.indexOf("large.jpg") > -1) {
showlarge(5,id);
}
if (whatSource.indexOf("large2.jpg") > -1) {
showlarge(6,id);
}
if (whatSource.indexOf("large3.jpg") > -1) {
showlarge(7,id);
}
if (whatSource.indexOf("large4.jpg") > -1) {
showlarge(8,id);
}
if (whatSource.indexOf("large9.jpg") > -1) {
showlarge(11,id);
}
if (whatSource.indexOf("large10.jpg") > -1) {
showlarge(12,id);
}
}
function swapPhoto2(){
holdpic = document.mainpic.src.replace("domecom/","domecomtn/");
//alert(holdpic);
document.mainpic.src = document.thumb2.src.replace("domecomtn/","domecom/");
document.thumb2.src=holdpic;
holdzoom = zoom1;
zoom1 = zoom2;
zoom2 = holdzoom;
}

function swapPhoto3(){
holdpic = document.mainpic.src.replace("domecom/","domecomtn/");
document.mainpic.src = document.thumb3.src.replace("domecomtn/","domecom/");
document.thumb3.src=holdpic;
holdzoom = zoom1;
zoom1 = zoom3;
zoom3 = holdzoom;
}

function swapPhoto4(){
holdpic = document.mainpic.src.replace("domecom/","domecomtn/");
document.mainpic.src = document.thumb4.src.replace("domecomtn/","domecom/");
document.thumb4.src=holdpic;
holdzoom = zoom1;
zoom1 = zoom4;
zoom4 = holdzoom;
}


function swapPhoto5(){
holdpic = document.mainpic.src.replace("domecom/","domecomtn/");
document.mainpic.src = document.thumb5.src.replace("domecomtn/","domecom/");
document.thumb5.src=holdpic;
holdzoom = zoom1;
zoom1 = zoom5;
zoom5 = holdzoom;
}


function swapPhoto6(){
holdpic = document.mainpic.src.replace("domecom/","domecomtn/");
document.mainpic.src = document.thumb6.src.replace("domecomtn/","domecom/");
document.thumb6.src=holdpic;
holdzoom = zoom1;
zoom1 = zoom6;
zoom6 = holdzoom;
}





function MM_swapmyImage() { //v3.0


 var i,j=0,x,a=MM_swapmyImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function MM_swapmyImage2() { //v3.0


 var i,j=0,x,a=MM_swapmyImage2.arguments; document.MM_sr=new Array;

 for(i=0;i<(a.length-2);i+=3) {
 if ((x=MM_findObj(a[i]))!=null){
 document.MM_sr[j++]=x; 
 if(!document.productForm.whatoption.value ){
 a[i+2] = "http://www.<?php echo $campaignurl?>/shop/design_surfdomecom/images/basket_button_choose.gif";
 } 
 if(!x.oSrc) x.oSrc=x.src; 
 x.src=a[i+2];}
}

}

function sendProductForm(flag) {
if (!document.productForm.whatoption.value && flag == 1) {
alert("Please choose a size");
return false;
}
document.productForm.submit();
}

function Postvideo(thequery) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', 'http://www.surfdome.com/vplayer.php?'+thequery, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
             document.getElementById('droppanel').innerHTML = self.xmlHttpReq.responseText;
        }
    }
	thequery = "";
	
    self.xmlHttpReq.send(thequery);
}

function Postproductvideo(thequery) {
	holdcontents = document.getElementById('picture1').innerHTML;
	holdzoomcontents = document.getElementById('zt').innerHTML;
	document.getElementById('zt').innerHTML = "";
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', 'http://www.surfdome.com/pplayer.php?'+thequery, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
             document.getElementById('picture1').innerHTML = self.xmlHttpReq.responseText;
			 brightcove.createExperiences();
        }
    }
	thequery = "";
	
    self.xmlHttpReq.send(thequery);
}

function closeproductvideo() {
	 document.getElementById('picture1').innerHTML = holdcontents;
	 document.getElementById('zt').innerHTML = holdzoomcontents;
}




function fillpanel(urlin,modein) {
	
	
	
	
	
if(modein == "swf") {
var so = new SWFObject(urlin, "sotester", "950", "380", "8", "#000000");
//alert("doing it!!!");
so.write('flashcontent');
}

if(modein == "htm") {
document.getElementById('droppanel').innerHTML = "";
Postvideo(urlin);
}





var h = 200;	// set this to 1/2 the width of the faw div defined in the style sheet 
			// there's not a reliable way to retrieve an element's width via javascript!!
					
	//var t = document.body.Height / 2;
//var t = (document.body.innerHeight)? document.body.innerHeight / 2:document.body.offsetHeight/ 2;

  scrOfY = 0 ;
    scrOfX = 0;
	startpoint = 340;


  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = 0 + window.pageYOffset;
    scrOfX = 0 + window.pageXOffset;
	startpoint = 0 + (window.innerHeight/ 2);
	startpointx = 0 + (window.innerWidth/ 2);
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = 0 + document.body.scrollTop;
    scrOfX = 0 + document.body.scrollLeft;
	startpoint = 100;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = 0 + document.documentElement.scrollTop;
    scrOfX = 0 + document.documentElement.scrollLeft;
	startpoint = 0 + document.documentElement.clientHeight/2;
	startpointx = 0 + document.documentElement.clientWidth/2;
  }
//if (window.pageYOffset){
//var t = (window.innerHeight/ 2) + (window.pageYOffset);
//}
	document.getElementById('droppanel').style.top = ((scrOfY-h)+startpoint)+"px";
//	document.getElementById('droppanel').style.left = (document.getElementById('wrapper').style.left)+"px";
	
	//document.getElementById('droppanel').style.margin = "0  -600px 0 0";
	
	//alert((scrOfY-h)+"px");



document.getElementById('droppanel').style.display = "block";
}
function closepanel() {
document.getElementById('droppanel').style.display = "none";
//document.getElementById('droppanel').style.display = "block";
}



zoom1="";
zoom2="";
zoom3="";
zoom4="";
function pushoption(valuein) {
document.productForm.whatoption.value = valuein;
}
function sizeguide(v,rc){
MM_openBrWindow('http://www.surfdome.com/sizeguide.php?v='+v+'&rc='+rc,'sizeguide','scrollbars=yes,width=800,height=760')
}
function doSwatch(swatch) {
document.ds_search.search.value = swatch;
document.ds_search.submit();
}

function sendProductForm(flag) {
if (!document.productForm.whatoption.value && flag == 1) {
alert("Please choose a size");
return false;
}
document.productForm.submit();
}

function emailFriend(pin){
 var url = 'http://www.surfdome.com/shop/cart.php?m=email_friend&p='+pin;
 friendWindow = window.open(url, 'find', ['width=420', 'height=450', 'left=150', 'top=150', 'scrollbars=yes', 'menubar=no', 'resizable=yes']);
 friendWindow.top.focus();
}

function checkReview(){
 if(!document.reviewForm.reviewName.value || !document.reviewForm.reviewBody.value){
 alert("Please enter your review text.");
 return false;
 }

 return true;
}

function followus() {
document.write('<img src="shop/design_surfdomecom/images/follow-us.gif" border="0" usemap="#follow" style = "width:150px;height:109px;" /><map name="follow" id="follow"><area shape="rect" coords="5,30,73,101" href="http://www.facebook.com/surfdome" alt = "Become a fan of our Surfdome Facebook page for news and exclusive offers." rel = "nofollow" title = "Become a fan of our Surfdome Facebook page for news and exclusive offers."/><area shape="rect" coords="77,29,147,104" href="http://twitter.com/Surfdome" alt = "Follow Surfdome on Twitter for latest news, deals and product arrivals."  rel = "nofollow" title = "Follow Surfdome on Twitter for latest news, deals and product arrivals."  /></map>');
}
