var xmlDoc = 	"/xmlInet/content/pw.xml";
var xsltDoc = 	"/xsltInet/pw.xslt";
//var infoXml = 	"http://orbiscoolthings.tumblr.com/api/read";
var infoXml = 	"http://inetstudios.tumblr.com/api/read";
var baseo2Net = "o2Net";
var saveApp =	"/ApplicationsiNet/saveConfig.aspx";
var positionTot = true;									//set to false when loading a pre-config
var userCook = 	"pwUser";
var savedCook = "pwSaved";
var grandTotal = 0;	

function runAccordion(){
	$("#accordion").accordion({
			collapsible: true,
			autoHeight: false
	});
}
function initialConfigLoad(){
	var savedCookie = "";
	
	if(getCookie(savedCook)){
		savedCookie = getCookie(savedCook);
	}else{
		savedCookie = 'inetStudios@gmail.com_The_Perfect_Website.js';
	}
	loadSavedConfig(savedCookie);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ panel ]
function configPrice(pid){
	var total = 0;
	var totalCatsStr = "";
	var formEls = document.config.elements;
	var totalPriceAdjustY = -100;
	var catName = "";
	var topCatName = "";
	var topCatCurValue = 0;	
	var htmlStr = "";
	var tOut = "";
	// ~~~~~~~~~~~~~~~~~ [ Total price
	for(i=0; i < formEls.length; i++){
		if(formEls[i].type == "checkbox"){
			if(formEls[i].checked == true){
				total += parseInt(formEls[i].value);
			}
		}
	}	
	
	grandTotal = total;
	
	htmlStr += '<div id="totalDiv"><h4 class="subhead">$' + addCommas(total) + '</h1></div>';

	// ~~~~~~~~~~~~~~~~~ [ Cats
	for(i=0; i < formEls.length; i++){
		if(formEls[i].type == "checkbox"){
			if(formEls[i].checked == true){
				catName = formEls[i].name;
				//catName = catName.substring(catName.indexOf('cat'),catName.lastIndexOf('_'));
				catName = catName.substring(catName.indexOf('cat'),catName.indexOf('cat')+4);	//************************HARD CODED*******************
				topCatName = 'inpt_nm_' + catName;
				//~~~~~~~~~~[
				if(totalCatsStr.indexOf(catName) == -1){
					if(totalCatsStr.length > 1){
						totalCatsStr += '~';	//Don't add until at least 1 is in
					}					
					totalCatsStr += catName + '|';
				}
				totalCatsStr += formEls[i].value;
				totalCatsStr += ',';
			}
		}
	}
	htmlStr += cateogryTotals(totalCatsStr);
	htmlStr += configComments();
	htmlStr += saveConfigDisplay();	

	if(getCookie(userCook) != ''){
		myConfigurations(getCookie(userCook));
	}else{
		myConfigurations('');
	}
	
	popularConfigurations();
	
	htmlStr += iWantThis();
	
	document.getElementById('totalPrice').innerHTML = htmlStr;
	reDrawSifr();
	if(window.positionTot == true){
		positionTotal('');
	}	
	positionTot = true;			//Re-set if we had just turned off for pre-config
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ end: panel ]
function configComments(){
	var htmlStr = "";
	htmlStr += '<div id="saveConfigTitle">';
	htmlStr += '<input class="totalPriceInput" id="configTitleInput" type="text" onMouseOver="showBorder(\'in\');" onMouseOut="showBorder(\'out\');" name="configTitle" value="' + parsePreload('configTitle') + '" />';
	htmlStr += '</div>';	
	htmlStr += '<div id="configCommentsDiv">';
	htmlStr += '<textarea id="configCommentsArea" name="configComments" cols="32" rows="5">' + parsePreload('configComments') + '</textarea>';
	htmlStr += '</div>';
	return htmlStr;
}
function showBorder(which){
	switch(which){
		case 'in':
			document.getElementById('configTitleInput').style.background = "transparent url(/images/interface/requestForm_inputBack.png) no-repeat 0px 0px";
			break;
		case 'out':
			document.getElementById('configTitleInput').style.background = "transparent url(/images/trans.gif) no-repeat 0px 0px";
			break;
		default:
			document.getElementById('configTitleInput').style.background = "transparent url(/images/interface/requestForm_inputBack.png) no-repeat 0px 0px";
	}	  
}
function saveConfigDisplay(){
	var htmlStr = "";
	var userCookie = "";
	var logInButVal = "sidePanel_but_save.png";
	if(getCookie(userCook) == '' || getCookie(userCook) == null){
		userCookie = "";
	}else{
		userCookie = getCookie(userCook);
	}

	htmlStr += '<div id="saveConfigDiv">';
	if(userCookie.length == 0){
		htmlStr += '<img src="/imagesInet/interface/sidePanel_login_msg.png" width="205" height="35" />';
		logInButVal = "sidePanel_but_login.png";
	}
	htmlStr += '<input class="totalPriceInput" type="text" name="configEmailId" value="' + userCookie + '" />';

	if(userCookie.length > 0){
		htmlStr += '<div id="logOutDiv"><a href="javascript:void(0);" onMouseDown="clearLogin();"><img src="/imagesInet/interface/sidePanel_but_logout.png" width="83" height="32" /></a></div>';
	}	
	htmlStr += '</div>';

	htmlStr += '<div id="saveConfigSubmit">';
	htmlStr += '<input type="image" src="/imagesInet/interface/' + logInButVal + '" onClick="saveConfigVals();return false;" />';
	htmlStr += '</div>';
	htmlStr += '<div id="myConfigurations">';
	htmlStr += '<img src="/imagesInet/interface/sidePanel_header_myConfigs.png" width="227" height="17" />';
	htmlStr += '<div id="myConfigurationsList"></div>';
	htmlStr += '</div>';
	htmlStr += '<div id="popularConfigs">';
	htmlStr += 		'<img src="/imagesInet/interface/sidePanel_header_popConfigs.png" width="227" height="17" />';
	htmlStr += 		'<div id="popularConfigurationsList"></div>';
	htmlStr += '</div>';
	htmlStr += '<div id="requestDiv"></div>';
	
	return htmlStr;	
}
function clearLogin(){
	SetGetCookie(userCook,"");
	SetGetCookie(savedCook,"");
	seeAlso('');
}
function saveConfigVals(){
	var HoldVals = '';
	var InPutBx = document.config.getElementsByTagName('input');
	var TextAreaBx = document.config.getElementsByTagName('textarea');
	var processString = saveApp + "?vars=";
	var emailId = document.config.configEmailId.value;
	var configTitle = document.config.configTitle.value;
	var configFileSaved = emailId + '_' + configTitle.replace(/ /g, "_") + '.js';
	
	if(validate('config','configEmailId') == false){
		//Alert provided by validate function
	}else{
		$.ajax({ url: "/applicationsInet/checkEmailExists.aspx?emailId=" + emailId, context: document.body, success: function(data){
        	//Good, now check if it exists
			if(data == 'True'){
				for (i=0; i<InPutBx.length;i++) {
					if(InPutBx[i].type != 'hidden' && InPutBx[i].type != 'button'){
						if(InPutBx[i].type == 'checkbox'){
							if(InPutBx[i].checked == true){
								HoldVals += "|" + InPutBx[i].name + '=' + InPutBx[i].value;
							}
						}else if(InPutBx[i].value != ''){
							HoldVals += "|" + InPutBx[i].name + '=' + InPutBx[i].value; 
						}	
					}
				}
				for (i=0; i<TextAreaBx.length;i++) {
					if(TextAreaBx[i].value != ''){
						HoldVals += "|" + TextAreaBx[i].name + '=' + TextAreaBx[i].value; 
					}
				}
				
				processString += HoldVals;
				//alert(processString);
				document['processSaveConfig'].src = processString;
				myConfigurations(emailId);
				SetGetCookie(userCook,emailId);
				SetGetCookie(savedCook,configFileSaved);
				//document.config.configCommentsArea.value = processString;
				setTimeout('window.location.reload()',1250);
				
			}else if(data == 'False'){
				alert('Email has been sent to create an account');
			}
		}});
	}
}
function registerEmailAccount(emailId){
	
}
function myConfigurations(emailId){
	if(emailId == ''){
		if(document.getElementById("myConfigurationsList")){
			document.getElementById("myConfigurationsList").innerHTML = "Log in to retrieve saved configurations";
		}else{
			setTimeout('myConfigurations(\'\')',10);
		}	
	}else{
		xmlhttpPost('/applicationsInet/getSavedConfigs.aspx?emailId=' + emailId,"myConfigurationsList");
	}	
}
function popularConfigurations(){
	//xmlhttpPost('/applicationsInet/getSavedConfigs.aspx?emailId=inetStudios@gmail.com',"popularConfigurationsList");
	$.ajax({ url: "/applicationsInet/getSavedConfigs.aspx?emailId=inetStudios@gmail.com", context: document.body, success: function(data){
		document.getElementById("popularConfigurationsList").innerHTML = data;
	}});
}
/* ~~~~~~~~~~~~~~~[ submit request ] ~~~~~~~~~~~~~~~~~~ */
function iWantThis(){
	var htmlStr = "";
	htmlStr += '<div id="iWantThisDiv">';
	htmlStr += '<img src="/imagesInet/interface/sidePanel_header_reqInfo.png" width="227" height="17" /> <br />';
	htmlStr += '<a href="javascript:void(0);" onClick="iWantThisGo();"><img src="/imagesInet/interface/sidePanel_iWantThis.png" width="159" height="27" /></a>';
	htmlStr += '</div>';
	return htmlStr;
}
function iWantThisGo(){
	var savedCookie = "";
	var userEmail = "";
	var ajaxUrl = "";
	
	if(getCookie(savedCook)){
		savedCookie = getCookie(savedCook);
	}else{
		savedCookie = 'inetStudios@gmail.com_The_Perfect_Website.js';
	}
		
	if(getCookie(window.userCook) != '' && getCookie(window.userCook) != null){
		userEmail = getCookie(window.userCook);
	}
		
	ajaxUrl = "/O2Net/Applications/TransformDoc/default.aspx?XmlDoc=/xmlInet/content/pw_request.xml&XsltDoc=/xsltInet/pw_request.xslt&XmlVars=configFileId|" + savedCookie + ",submitterEmail|" + userEmail + ",projectConfigId|" + savedCookie;	
		
	$.ajax({ url: ajaxUrl, context: document.body, success: function(data){
		document.getElementById("requestDiv").innerHTML = data;
	}});	
	
	$.fancybox({
		'padding'		: 0,
		'href'			: '#requestDiv',
		'overlayColor'	: '#000',
		'overlayOpacity':   .6,
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		//width/height - see .infoContent	
		onStart		:	function() {
			document.getElementById('requestDiv').style.display = 'block';
		},		
		onComplete	:	function() {
            reDrawSifr();
		},		
		onClosed	:	function() {
            document.getElementById('requestDiv').style.display = 'none';
		}		
	});	
}
function requestLoadData(fileToLoad){
	//Triggered from image within xslt
	document.pwRequest.Project_Price_Estimate.value = addCommas(window.grandTotal);
	document.pwRequest.Project_Name.value = parsePreload('configTitle');
}
function submitRequest(){
	formvalidation('pwRequest');return false;
}
/* ~~~~~~~~~~~~~~~[ end: submit request ] ~~~~~~~~~~~~~~~~~~ */
function cateogryTotals(catStr){
	var cats = catStr.split("~");
	var catsHash;
	var catsTotals;
	var catsSubTotals;
	var catsSum = 0;
	var topCatName;
	var catArray = [];
	var htmlStr = "";
	/*
		Category ids are dynamically assigned by position and level.  That way, we can always
		Trace back to the parent id easily and total per top level category - that's how parent child is worked out
		
	*/
	for(i = 0; i < cats.length; i++){
		catsHash = cats[i].split("|");
		topCatName = 'inpt_nm_' + catsHash[0];
		catsSubTotals = catsHash[1].split(",");
		catArray[i] = 0;
		htmlStr += '<div class="row">';
		htmlStr += '<div class="catName">' + catRenam(catsHash[0]) + '</div>';
		for(j = 0; j < catsSubTotals.length-1; j++){
			catArray[i] += parseInt(catsSubTotals[j]);
		}
		if(eval("document.config." + topCatName)){
			eval("document.config." + topCatName).value = catArray[i];
		}	
		htmlStr += '<div class="catTotal">$' + addCommas(catArray[i]) + '</div>';
		htmlStr += '</div>';
	}
	return htmlStr;
}
function catRenam(cat){
	switch(cat){
		case 'cat1':
			return 'Planning, Design, PM';
			break;
		case 'cat2':
			return 'CMS';
			break;
		case 'cat3':
			return 'Applications';
			break;
		case 'cat4':
			return 'Custom Applications';
			break;			
		case 'cat5':
			return 'Design';
			break;
		case 'cat6':
			return 'Content';
			break;
		case 'cat7':
			return 'Promotion';
			break;
		case 'cat8':
			return 'Hosting';
			break;
		case 'cat9':
			return 'Collaboration/Docs/Train';
			break;
		case 'cat10':
			return 'aa';
			break;
		case 'cat11':
			return 'bb';
			break;			
		default:
			return cat
	}	
}
function positionTotal(pos){
	var mPosY = 0;
	var mPosYCeiling = 115;
	
	if(pos.length != 0){
		mPosY = pos;
	}else{
		if (navigator.appName == 'Netscape') {
			totalPriceAdjustY = -180;
		}else{
			totalPriceAdjustY = 35;
		}
		mPosY = window.yMousePos + totalPriceAdjustY;
		
		if(mPosY < mPosYCeiling){
			mPosY = mPosYCeiling;
		}
	}
	document.getElementById('totalPrice').style.top = mPosY + 'px';
}
function explInfo(infoId){
	var xmlUrl = "/" + baseo2Net + "/applications/transformDoc/wrapXml.aspx?wrapDoc=false&XmlWrapDoc=" + window.infoXml;
	var description = "";
	var title = "";
	var postId = "";
	
	$.ajax({
		type: "GET",
		url: xmlUrl,
		dataType: "xml",
		
		success: function(xml) {
			$(xml).find('post').each(function(){
				title = $(this).find('video-caption').text();
				postId = $(this).attr('id');
				if(postId == infoId){
					description = $(this).text();
				}
			});
		},
		complete: function(){
				explInfo_out(description,infoId);
	  	},
		error: function(XMLHttpRequest, textStatus, errorThrown){
	    	alert('error: XMLHttpRequest ' + XMLHttpRequest);
			alert('error: textStatus ' + textStatus);
			alert('error: errorThrown ' + errorThrown);
	  	}
	});	
}
function explInfo_out(str,infoId){
	var yPos = yMousePos - 100; 	//Adjust the general position
	var htmlStr = "";
	
	htmlStr += '<div class="infoContent">' + str + '</div>';
	
	document.getElementById('info_' + infoId).innerHTML = htmlStr;

	$.fancybox({
		'padding'		: 0,
		'href'			: '#info_' + infoId,
		'overlayColor'	: '#000',
		'overlayOpacity':   .6,
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		//width/height - see .infoContent	
		onStart		:	function() {
			document.getElementById('info_' + infoId).style.display = 'block';
		},		
		onComplete	:	function() {
            reDrawSifr();
		},		
		onClosed	:	function() {
            document.getElementById('info_' + infoId).style.display = 'none';
		}		
	});	
}
function explImg(imgId,imgInfo){
	if(imgId.indexOf('|') != -1){
		var mySplitResult = imgId.split("|");
		
		if(mySplitResult.length == 2){
			$.fancybox([
				'/imagesInet/content/pw/' + mySplitResult[0],
				{
					'href'	: '/imagesInet/content/pw/' + mySplitResult[1]
				}
			], {
				'padding'			: 0,
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'type'              : 'image',
				'overlayColor'	: '#000', 
				'overlayOpacity':   .6,
				'overlayShow'	:	true
			});		
		}else if(mySplitResult.length == 3){
			$.fancybox([
				'/imagesInet/content/pw/' + mySplitResult[0],
				'/imagesInet/content/pw/' + mySplitResult[1],
				{
					'href'	: '/imagesInet/content/pw/' + mySplitResult[2]
				}
			], {
				'padding'			: 0,
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'type'              : 'image',
				'overlayColor'	: '#000', 
				'overlayOpacity':   .6,
				'overlayShow'	:	true
			});			
		}else if(mySplitResult.length == 4){
			$.fancybox([
				'/imagesInet/content/pw/' + mySplitResult[0],
				'/imagesInet/content/pw/' + mySplitResult[1],
				'/imagesInet/content/pw/' + mySplitResult[2],
				{
					'href'	: '/imagesInet/content/pw/' + mySplitResult[3]
				}
			], {
				'padding'			: 0,
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'type'              : 'image',
				'overlayColor'	: '#000', 
				'overlayOpacity':   .6,
				'overlayShow'	:	true
			});			
		}else if(mySplitResult.length == 5){
			$.fancybox([
				'/imagesInet/content/pw/' + mySplitResult[0],
				'/imagesInet/content/pw/' + mySplitResult[1],
				'/imagesInet/content/pw/' + mySplitResult[2],
				'/imagesInet/content/pw/' + mySplitResult[3],
				{
					'href'	: '/imagesInet/content/pw/' + mySplitResult[4]
				}
			], {
				'padding'			: 0,
				'transitionIn'	:	'elastic',
				'transitionOut'	:	'elastic',
				'type'              : 'image',
				'overlayColor'	: '#000', 
				'overlayOpacity':   .6,
				'overlayShow'	:	true
			});			
		}
		
	}else{
		$.fancybox({
			'href'			: '/imagesInet/content/pw/' + imgId,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'title'			:	imgInfo,
			'speedIn'		:	200, 
			'speedOut'		:	200,
			'overlayColor'	: '#000', 
			'overlayOpacity':   .6,
			'overlayShow'	:	true,
			'padding'		: 0,
			'titlePosition'	: 'over'
		});	
	}
}
function explVid(vidId){
	$.fancybox({
		'padding'		: 0,
		'autoScale'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'overlayOpacity':   .6,
		'overlayColor'	: '#000',
		'width'			: 640,
		'height'		: 505,
		'href'			: 'http://www.youtube.com/v/' + vidId,
		'type'			: 'swf',
		'swf'			: {
		    'wmode'				: 'transparent',
			'allowfullscreen'	: 'true'
		}
	});

	return false;
}
function closeThis(){
	document.getElementById('expl').style.display = 'none';
	document.getElementById('expl').innerHTML = '';
}
function loadSavedConfig(fileToLoad){									//******** Install the file first
	var savedConfigFile = "/javascript/pw/" + fileToLoad;
	SetGetCookie(savedCook,fileToLoad);
	$import(savedConfigFile);
	setTimeout('loadConfiguration();',100);
}
function loadConfiguration(){											//******** Loop to ensure the file is loaded
	count = 0;
	if(typeof(configVars) == 'undefined'){
		count += 1;
		if(count < 100){
			setTimeout('loadConfiguration()',10);	
		}else{
			alert('file not found');
		}	
	}else{
		runConfig();
	}
}
function runConfig(){													//******** Prefill now that the vars have been set
	var mySplitResult = configVars.split("|");
	var InPutBx = document.config.getElementsByTagName('input');
	var TextAreaBx = document.config.getElementsByTagName('textarea');
	var checkFormEl = "";
	var t = "";
	for (i=0; i<InPutBx.length;i++) {
		checkFormEl = InPutBx[i].name;
		InPutBx[i].checked = false;													//clear previous
		t += InPutBx[i].name + ",";
		if(configVars.indexOf(checkFormEl) != -1){
			if(InPutBx[i].type == 'checkbox'){
				InPutBx[i].checked = true;
			}		
			if(InPutBx[i].type == 'input'){
				InPutBx[i].value = parsePreload(InPutBx[i].name);
			}	
		}
	}	
	positionTot = false;			//Don't position total when we first update
	configPrice('');

}
function configLoadedYAH(){
	var listId = "";
	if(getCookie(window.savedCook)){
		listId = getCookie(savedCook);
	}else{
		listId = 'inetStudios@gmail.com_The_Perfect_Website.js';
	}
	listId = listId.replace(/@/g, "");
	listId = listId.replace(/.js/g, "");
	listId = listId.replace(/\./g, "_");
	if(listId != ""){
		if(document.getElementById(listId)){
			document.getElementById(listId).style.background = "#ffc41d";
		}	
	}	
}
function parsePreload(varGet){
	if(configVars.indexOf(varGet) != -1){
		var strGet = configVars.substring(configVars.indexOf(varGet)+varGet.length+1);
		var strGet2 = strGet.substring(0,strGet.indexOf('|'));
		return strGet2;
	}else{
		return "";
	}	
}
// ~~~~~~~~~~~~~~~~~~~~~~~~[ common ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function createDivTag(divParentName,newDivIdName){
	var divParent = document.getElementById(divParentName);		
	var newdiv = document.createElement('div');
	var divIdName = newDivIdName;

	newdiv.setAttribute('id',divIdName);
	newdiv.innerHTML = '<img src=\"/images/trans.gif\" />';
	divParent.appendChild(newdiv);
}
function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
  	}
	return "999";
}
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
// ~~~~~~~~~[ mouse pos ] ~~~~~~~~
if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 	0; // Horizontal position of the mouse on the screen
yMousePos = 	0; // Vertical position of the mouse on the screen
xMousePosMax = 	0; // Width of the page
yMousePosMax = 	0; // Height of the page

function captureMousePosition(e) {
    if (document.layers) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}
// ~~~~~~~~~~~~~~~~~~[ end mouse pos ] ~~~~~~~~~~~~~~~~~~~~~~~~
var xmlVars = "";

function runAjax(){
	var XmlVars = "&XmlVars=a|";
	var ajaxString = "";
	if(document.getElementById("leftcontent")){
		if(getQueryVariable('seeAlso') != '999'){
			XmlVars += ',seeAlso|' + getQueryVariable('seeAlso');
		}
		if(getQueryVariable('loadUser') != '999'){
			SetGetCookie(userCook,getQueryVariable('loadUser'));
			SetGetCookie(savedCook,getQueryVariable('loadUser') + '_The_Perfect_Website.js');			
		}
		if(window.xmlVars != ''){
			XmlVars += xmlVars;
		}
		createDivTag("leftcontent","googleSprdsht_div");
		ajaxString = '/o2Net/Applications/TransformDoc/default.aspx?XmlDoc=' + window.xmlDoc + '&XsltDoc=' + window.xsltDoc + XmlVars;
		xmlhttpPost(ajaxString,"googleSprdsht_div");
	}else{
		setTimeout('runAjax()',250);
	}
}

runAjax();

function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
  	}
	return "999";
}
function seeAlso(xmlVarsSet){
	xmlVars = ',seeAlso|' + xmlVarsSet;
	runAjax();  
}
function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
      return false;
   }
}

