
//CLZ: note: the new_name is necessary so that the program will open a new window. If you don't do this, the second thing they click on will get loaded into the last window, which might be hidden.
		//CLZ note: ifthe description list in the window.open command has any spaces in it, netscape ignores it. :(
		function jsLoadPage(new_url){
			document.location = new_url;
		}
		
		function NewBrowser(new_url,new_name){
			var myWin = window.open(new_url,new_name,"status=1,menubar=1,toolbar=1,location=1,resizable=1,scrollbars=1,width=500,height=400");
		}
		
		function jsViewFormat(new_url,new_name){
			var myWin = window.open(new_url,new_name,"status=1,resizable=1,scrollbars=1,width=600,height=670");
		}
		
		function jsViewClip(new_url,new_name){
			var myWin = window.open(new_url,new_name,"status=1,menubar=0,toolbar=0,location=0,resizable=0,scrollbars=0,width=320,height=340");
			myWin.focus();
		}
		
		function jsShowBigImage(productdir, mediaurl, title, length){
			var myWin = window.open("http://www.sourcevisuals.com/source/preview_clip.aspx?productdir=" +productdir + "&mediaurl=" + mediaurl + "&title=" + title + "&length=" + length,"clipviewer","status=0,menubar=0,toolbar=0,location=0,resizable=0,scrollbars=0,width=640,height=528");
			myWin.focus();
		}
		
		function jsViewFrames(new_url,new_name){
			var myWin = window.open(new_url,new_name,"status=1,menubar=0,toolbar=0,location=0,resizable=0,scrollbars=1,width=338,height=260");
			myWin.focus();
		}
		
		function jsShowMovie(id,url){
			//alert(id + ' ' + url);
			
			document.getElementById(id).src = url;
		}
		
		/*function jsAddToCart(id,url){
			//alert(id + ' ' + url);
			var myWin = window.open(new_url,new_name,"status=1,menubar=1,toolbar=1,location=1,resizable=1,scrollbars=1,width=600,height=400");
			myWin.focus();
			
			//document.getElementById(id).src = url;
		}*/
		
		preloadfdsafdsfds = new Image();
			preloadfdsafdsfds.src = "images/add_to_cart3_down.gif";
			
			
/*AJAX FUNCTIONS --------------------------------------------------------------------------*/
			
		 
var xmlHttp;
function ajaxFunctionOld(sURL,oResponseHandler)
{
    /*
	try{
        xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari}
    }catch (e){// Internet Explorer
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }*/
	xmlHttp = new SWFHttpRequest();
	alert(xmlHttp);
    //xmlHttp.onreadystatechange = jsLoadSourceContent;
    xmlHttp.onreadystatechange = oResponseHandler;
    xmlHttp.open("GET",sURL,true);
    xmlHttp.send(null);
  }
  
  var shr

//USES FlashProxy swf file SWFHttpRequest. See http://jimbojw.com/wiki/index.php?title=SWFHttpRequest_Flash/Ajax_Utility
function ajaxFunction(sURL){
	//alert('ajaxFunction:'+sURL);
	try
	{
		shr = new SWFHttpRequest();
	}
	catch(err)
	{
		//Handle errors here
		//alert("wait");
		var sCall = "ajaxFunction('"+sURL+"')";
		setTimeout(sCall,100);
		return;
	}
	
	if (SWFHttpRequest){
		//alert("its there");
	}else{
		//alert("not there");
	}

	shr = new SWFHttpRequest();
	//var url = "http://www.sourcevisuals.com/source/partnermodule_catalog.aspx?partnercode=TEST1&cartpage=sourcepartner_cart.htm&prodpage=sourcepartner_product.htm";
	//sURL = "http://localhost/source4/partnermodule_product.aspx?partnercode=TEST1&cartpage=sourcepartner_cart.htm&prodpage=sourcepartner_product.htm&productid=10";
	//sURL = "http://www.sourcevisuals.com/source/partnermodule_catalog.aspx?partnercode=TEST1&cartpage=sourcepartner_cart.htm&prodpage=sourcepartner_product.htm";
	shr.onreadystatechange = jsLoadSourceContent;
	//shr.onreadystatechange = oResponseHandler;
	shr.open( 'GET', sURL );
	shr.send( 'some=post&data=here' );
	
}

	
function jsLoadSourceContent(){	
	if(shr.readyState==4){
		if (shr.status==200) {
	       // Success! 
		document.getElementById("source_content").innerHTML = shr.responseText;
	   } else {
	       // Oops - something went wrong :(
		document.getElementById("source_content").innerHTML = "Could not load visuals data from server.";
	   }
	}
}
	
		var sourceroot = "http://localhost/source4/";
		sourceroot = "http://www.sourcevisuals.com/source/";
		
function jsSourceRenderProduct(sParams){
	jsLoadSourceProduct(sourceroot + 'partnermodule_product.aspx?'+sParams);
}

function jsSourceRenderCatalog(sParams){
	ajaxFunction(sourceroot + 'partnermodule_catalog.aspx?'+sParams);
}

var qsParm = new Array();
function qs() {
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
}
qsParm['productid'] = "";
qsParm['skucode'] = "";
qsParm['remove'] = "";
qsParm['type'] = "";
qsParm['cartitem'] = "";

qs();//load querystring

//adds the productid parameter to the url.
function jsLoadSourceProduct(sURL,oResponseHandler){
	sURLNew = sURL + "&productid=" + qsParm['productid'];
	//alert(sURLNew);
	ajaxFunction(sURLNew);

}

//adds the productid parameter to the url.
function jsLoadSourceCart(sURL){

    
    
	sURLNew = sURL + "&skucode=" + qsParm['skucode'] + "&type=" + qsParm['type'] + "&cartitem=" + qsParm['cartitem'] + "&productid=" + qsParm['productid'];
	//alert(sURLNew);
	ajaxFunction(sURLNew);
	

   
}

function jsCartInitilizeDotNet(){
 //init ASP.NET stuff.
    theForm = document.forms['aspnetForm'];
    if (!theForm) {
        theForm = document.aspnetForm;
    }
    alert(theForm);
}

//FOR CART and PartnermODULE AJAX include
var theForm;

function __doPostBack(eventTarget, eventArgument) {
 
 if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
 }
}

//cart - change type of cart item.
function jsChangeType(iCartItemID, iProductID,sCartURL){
        
        var oSelect = document.getElementById("changeType" + iCartItemID);
        //alert("index:" + oSelect.selectedIndex);
        var sProductSKUType = oSelect.options[oSelect.selectedIndex].value;
        
        var sUrl = sCartURL + "?type=" + sProductSKUType + "&cartitem=" + iCartItemID + "&productid=" + iProductID;
        document.location.href= sUrl;
    }
    
function jsCheckOut(){
       document.getElementById('formcheckout').submit();
}
            
function jsSubmitPaypalTest(){
    document.getElementById('formtest').submit();
}

function jsSubmitResolumeTest(){
    document.getElementById('formtest').action="notify_ipn_resolume.aspx";
    document.getElementById('formtest').submit();
}

			