
//change the following lines for new distributors only

var ProductCode = '1032';
var ProductDownload = '1046';
var ProductChoice = ProductCode;
var URLVisible = true;
var HomePage = 'http://www.copymydvd.com'

//end of change lines

var SalesAmount = 39.95;
var notifyURL = 'http://secure.321studio.com/solo/paypal.asp';
var ReturnURL = 'https://secure.321studio.com/solo/customers/default.asp';
var CancelReturnURL = 'http://www.321studios.com';
var PayPalAddress = 'sales@321studio.com';
var Download = 0.00;
var DomUSPS = 5.95;
var DomUSPSPriority = 10.95;
var DomFedEx = 15.95;
var IntUSPS = 7.95;
var IntFedEx = 17.95;
var ShipID = 1;
var DomUSPSName = 'USPS STD';
var DomUSPSPriorityName = 'USPS PRI';
var DomFedExName = 'FEDEX STD';
var IntUSPSName = 'INT STD';
var IntFedExName = 'INT GLOBAL';
var ShortShipName = 'USPS STD';
var ProductDesc = 'DVD-COPY Ver 4.0 CDR Software (1 CD)*'
var AspPage = 'newordvercust.asp';
var IntAspPage = 'newordvericust.asp';
var FormAction = '';
var	URLVisibleAction ='https://secure.321studio.com/solo/products/'
var URLHiddenAction = 'https://secure.321studio.com/solo/products/'
var International = false;
var CookieExpires = 365;
var CookiesEnabled = '';
var crlf = unescape("%0D%0A");
var exit=false;

QueryString.keys = new Array();
QueryString.values = new Array();

QueryString_Parse();

// redirect for Kazza
// Kazza Redirect removed at request of Brandon Phillips - RJT
//if( QueryString('a') == 28819 ) {
//	location = 'http://x.hitprofile.com/x.asp?pid=349&oid=651&sid=';
//}
	
if (QueryString('a') != 0) {
	setCookie('AffiliateID', QueryString('a'), CookieExpires);
}

var affID = getCookie('AffiliateID');
// alert('The Aff ID is: ' + affID);
//if( affID == 28819 ) {
//	location = 'http://x.hitprofile.com/x.asp?pid=349&oid=651&sid=';
//}

var CountTagSrc = 'http://secure.321studio.com/solo/products/info.asp?a=' + affID;

//alert('Cookies Enabled: ' + CookiesEnabled + '. Your Affiliate ID stored in the cookie is ' + affID);

if (URLVisible==false) {
	if (document.layers)
		document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

	document.onmouseover=hidestatus
	document.onmouseout=hidestatus
}

function out() {
    if (exit)
    {
    window.open('http://www.321studios.com/hello.htm','ftp',"toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=390");
	window.open('http://www.321studios.com/goodbye.htm','ftp',"toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=390");
    //window.open('http://www.3turtles.com/redir/glflow36.asp','_blank','top=1600,left=1600,width=587,height=screen.availHeight,directories=no,location=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no');
    }
}

function PopPetition() {
    window.open('http://www.321studios.com/petition.asp');
}

function hidestatus(){
	window.status=''
	return true
}

function OrderButton_OnClick() {
	document.location = 'OrderChooseCountry.htm' + getAffiliateURLString('?');
}

function NextButton_onclick() {
	if (document.frmOrder.shippingdest[0].checked) {
		document.location = 'order2_usa.htm' + getAffiliateURLString('?');
	} else {
		document.location = 'order2_int.htm' + getAffiliateURLString('?');
	}
}


function products_onmouseover() {
	productsline.style.textDecorationUnderline = true;
	productsline.style.fontWeight = 'bold';
}

function products_onmouseout() {
	productsline.style.textDecorationUnderline = false;
	productsline.style.fontWeight = 'normal';
}

function faq_onmouseover() {
	faqline.style.textDecorationUnderline = true;
	faqline.style.fontWeight = 'bold';
}

function faq_onmouseout() {
	faqline.style.textDecorationUnderline = false;
	faqline.style.fontWeight = 'normal';
}

function contact_onmouseover() {
	contactline.style.textDecorationUnderline = true;
	contactline.style.fontWeight = 'bold';
}

function contact_onmouseout() {
	contactline.style.textDecorationUnderline = false;
	contactline.style.fontWeight = 'normal';
}

function CalcTotalAmount(blnIntl) {
	var shipping = 0.00;
	var amount = SalesAmount;
	var totamount = 0.00;
	var strDesc = '';
	var strAmount = '';
	
	
	if (document.frmOrder.shipping[0].checked) {

		if (! blnIntl) {
			International = false;
			shipping = DomUSPS; 
			ShortShipName = 'USPS STD';
			strDesc = ProductDesc;
			document.PAYPAL.shipping.value = DomUSPS;
			document.PAYPAL.item_name.value = strDesc;
		} else {		
			International = true;
			AspPage = IntAspPage;
			shipping = IntUSPS;
			ShortShipName = 'INT STD';
			strDesc ='INT ' + ProductDesc;
			document.PAYPAL.shipping.value = IntUSPS;
			document.PAYPAL.item_name.value = strDesc;
		}
	} else {
		
		if (document.frmOrder.shipping[1].checked) {
			if (! blnIntl) {
				International = false;
				shipping = DomUSPSPriority;
				ShortShipName = 'USPS PRI';
				strDesc = 'PRI ' + ProductDesc;
				document.PAYPAL.shipping.value = DomUSPSPriority;
				document.PAYPAL.item_name.value = strDesc;
			} else {
				International = true;
				AspPage = IntAspPage;
				shipping = IntFedEx;
				ShortShipName = 'INT GLOBAL';
				strDesc ='GLO ' + ProductDesc;
				document.PAYPAL.shipping.value = IntFedEx;
				document.PAYPAL.item_name.value = strDesc;
			}
		} else {
						
			if (document.frmOrder.shipping[2].checked) {
				International = false;
				shipping = DomFedEx;
				ShortShipName = 'FEDEX STD';			
				strDesc ='FDX ' + ProductDesc;
				document.PAYPAL.shipping.value = DomFedEx;
				document.PAYPAL.item_name.value = strDesc;
			}
		}					
	}
	totamount = shipping + amount;
	
	document.PAYPAL.item_name.value = strDesc;
	document.PAYPAL.amount.value = amount;
	document.PAYPAL.shipping.value = shipping;
	document.PAYPAL.shipping2.value = shipping;
	document.PAYPAL.custom.value = ShortShipName + '|' + getCookie('AffiliateID');
	
	strAmount = totamount.toString() + '0';
	strAmount = strAmount.substring(0, 5);
	document.frmOrder.txtSalesAmount.value = '$' + strAmount;

	ShipmentProcess(shipping);
	FormAction = URLVisibleAction + AspPage + '?T=' + ProductChoice + '&U=&C=&P=&D=' + getCookie('AffiliateID') + '&SID=' + ShipID;
}

function CalcTotalAmount2(blnIntl) {
	var shipping = 0.00;
	var amount = SalesAmount;
	var totamount = 0.00;
	var strDesc = '';
	var strAmount = '';
	
	if (usps.checked) {
		if (! blnIntl) {
			International = false;
			shipping = DomUSPS; 
			ShortShipName = 'USPS STD';
			strDesc = ProductDesc;
		} else {
			International = true;
			AspPage = IntAspPage;
			shipping = IntUSPS;
			ShortShipName = 'INT STD';
			strDesc ='INT ' + ProductDesc;
		}
	} else {
		if (! blnIntl) {
			International = false;
			shipping = DomFedEx;
			ShortShipName = 'FEDEX STD';			
			strDesc ='FDX ' + ProductDesc;
		} else {
			International = true;
			AspPage = IntAspPage;
			shipping = IntFedEx;
			ShortShipName = 'INT GLOBAL';
			strDesc ='GLO ' + ProductDesc;
		}
	}
	totamount = shipping + amount;
	
	document.PAYPAL.item_name.value = strDesc;
	document.PAYPAL.amount.value = amount;
	document.PAYPAL.shipping.value = shipping;
	document.PAYPAL.shipping2.value = shipping;
	document.PAYPAL.custom.value = ShortShipName + '|' + getCookie('AffiliateID');
	
	strAmount = totamount.toString() + '0';
	strAmount = strAmount.substring(0, 5);
	totalamount.innerHTML = '<FONT color=red size=2>$' + strAmount + '</FONT>';

	ShipmentProcess(shipping);
	FormAction = URLVisibleAction + AspPage + '?T=' + ProductChoice + '&U=&C=&P=&D=' + getCookie('AffiliateID') + '&SID=' + ShipID;
}

function imgFedEx_onclick() {
	fedex_onclick();
}

function imgUSPS_onclick() {
	 usps_onclick();
}

function imgUSPSPriority_onclick() {
	uspspriority_onclick();
}

function txtFedEx_onclick() {
	fedex_onclick();
}

function txtUSPS_onclick() {
	usps_onclick();
}

function ProcessMCForm() {
	if (URLVisible) {
		document.location = FormAction;
	} else {
		switch (ShipID) {
			case 1 :
				if (International) {
					FormAction ='ordermc1i.htm' + getAffiliateURLString('?');
				} else {
					FormAction ='ordermc1.htm' + getAffiliateURLString('?');
				}
				break
			case 2 :
				if (International) {
					FormAction ='ordermc2i.htm' + getAffiliateURLString('?');
				} else {
					FormAction ='ordermc2.htm' + getAffiliateURLString('?');
				}
				break
			case 3 :
				FormAction ='ordermc3.htm' + getAffiliateURLString('?');
				break
			case 4 :
				
		}
		//document.write('<FRAMESET rows=*,0><FRAME name=main id=main src=' + FormAction +'>');
		//document.write('<FRAME name=holder id=holder></FRAMESET>');
		document.location = FormAction;
	}		
}

function ProcessPayPalForm() {
	document.PAYPAL.business.value = PayPalAddress;
	document.PAYPAL.item_number.value = ProductChoice;
	document.PAYPAL.returnURL.value = ReturnURL;
	document.PAYPAL.returnURL.name = 'return';
//	document.PAYPAL.cancel_return.value = CancelReturnURL;
	document.PAYPAL.notify_url.value = notifyURL;
}

function inputMC_onclick() {
	document.frmOrder.action=FormAction;
	document.frmOrder.submit();
}

function inputPayPal_onclick() {
	document.frmOrder.action=FormAction;
	document.frmOrder.submit();
}

function writeHTML(src) {
	//if (top.frames.length != 0) {
		switch (src) {
			case 'mc1' :
				//USPS
				document.ORDER.Shipping.value = 1;
				break
			case 'mc2' :
				//USPS Priority
				document.ORDER.Shipping.value = 2;
				break
			case 'mc3' :
				//FEDEX
				document.ORDER.Shipping.value = 3;
				break
			case 'mc1i' :
				//International USPS
				document.ORDER.Shipping.value = 4;
				break
			case 'mc2i' :
				//Global Priority
				document.ORDER.Shipping.value = 5;
				break
		}
		//window.ORDER.action = URLHiddenAction;
		document.ORDER.action = URLHiddenAction;
		document.ORDER.Description.value = ProductDesc;
		document.ORDER.Price.value = SalesAmount;
		document.ORDER.ProductOptionID.value = ProductChoice;
		document.ORDER.AffiliateID.value = getCookie('AffiliateID');
		document.ORDER.submit();
	//} else {
	//	window.location = 'index.htm';
	//}
}

function ShipmentProcess(shipprice) {
	switch (shipprice) {
		case DomUSPS :
			ShipID = 1;
			break
		case DomUSPSPriority :
			ShipID = 2;
			break
		case DomFedEx :
			ShipID = 3;
			break
		case IntUSPS :
			ShipID = 1;
			break
		case IntFedEx :
			ShipID = 2;
			break
		case Download :
			ShipID = 4;
			break;
	}
}

function getCookie(NameOfCookie)
{
	CookiesEnabled = false;
	if (document.cookie.length > 0) { 
	    begin = document.cookie.indexOf(NameOfCookie+"="); 
	    if (begin != -1) { 
			CookiesEnabled = true;
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end));       
		} 
	}
	return QueryString('a');  
}

function setCookie(NameOfCookie, value, expiredays) 
{
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + 
	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function delCookie (NameOfCookie) 
{
	if (getCookie(NameOfCookie)) {
		document.cookie = NameOfCookie + "=" +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function QueryString(key)
{
	var value = 0;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		}
	}
}

function getAffiliateURLString(src) {
	if (CookiesEnabled==true) {
		return '';
	} else {
		return src + 'a=' + getCookie('AffiliateID');
	}
}

function counttag_onclick() {
	window.counttag.src = CountTagSrc;
	//alert(CountTagSrc);
}

