function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		}
	}
	return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function getQ(){
	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;		
		}
	}
}



getQ();



function writeName(){
var headerTxt= document.getElementById("titleTxt").value;
document.write(headerTxt);
}

function writeBody(){
var bodyTxt= document.getElementById("bodyTxt").value;
document.write(bodyTxt);
}

// write flash obj with query string

function writeFlash() {

	var leftImage= document.getElementById("leftImage").value;
	var flashHeader= document.getElementById("flashHeader").value;
	var districts = document.getElementById("districts").value;
	var overview = document.getElementById("overview").value;
	var request = document.getElementById("request").value;
	var testimonials = document.getElementById("testimonials").value;
	var integration = document.getElementById("integration").value;
	var webinar = document.getElementById("webinar").value;
	var caseStudy = document.getElementById("caseStudy").value;
	var interactiveO = document.getElementById("interactiveO").value;
	var userGroup = document.getElementById("userGroup").value;
	var registration = document.getElementById("registration").value;
	var bringAFriend = document.getElementById("bringAFriend").value;
	var districtsUrl = "/maps/default.aspx?State=" + document.getElementById("districtsUrl").value;
	var overviewUrl = document.getElementById("overviewUrl").value;
	var requestUrl = document.getElementById("requestUrl").value;
	var testimonialsUrl = document.getElementById("testimonialsUrl").value;
	var integrationUrl = document.getElementById("integrationUrl").value;
	var webinarUrl = document.getElementById("webinarUrl").value;
	var caseStudyUrl = document.getElementById("caseStudyUrl").value;
	var interactiveOUrl = document.getElementById("interactiveOUrl").value;
	var userGroupUrl = "/maps/default.aspx?State=" + document.getElementById("userGroupUrl").value;
	var registrationUrl = document.getElementById("registrationUrl").value;
	var bringAFriendUrl = document.getElementById("bringAFriendUrl").value;
	var fs_id = document.getElementById("fs_id").value;
	var imt = document.getElementById("imt").value;
	var iml = document.getElementById("iml").value;
	var learnMore = document.getElementById("learnMore").value;
	var learnMoreURL = document.getElementById("learnMoreURL").value;
	var upcomingUG = document.getElementById("upcomingUG").value;
	var upcomingUGURL = document.getElementById("upcomingUGURL").value;
	var showMap = "no";
	var flashVariables = leftImage + "------" + flashHeader + "------" + districts + "------" + overview + "------" + request + "------" + testimonials + "------" + integration + "------" + webinar + "------" + caseStudy + "------" + interactiveO + "------" + userGroup + "------" + registration + "------" + bringAFriend + "------" + districtsUrl + "------" + overviewUrl + "------" + requestUrl + "------" + testimonialsUrl + "------" + integrationUrl + "------" + webinarUrl + "------" + caseStudyUrl + "------" + interactiveOUrl + "------" + registrationUrl + "------" + userGroupUrl + "------" +  bringAFriendUrl  + "------" + showMap + "------" + imt + "------" + iml  + "------" + fs_id  + "------" + learnMore  + "------" + learnMoreURL  + "------" + upcomingUG  + "------" + upcomingUGURL;
	
	
	
	//array1 = flashVariables.split("------");
	//alert(array1[21]);

	var width = '680';

	var height = '270';

	
		var src = '/flash/landingTemplate';




 //end AC code









	// assemble flash obj

	AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','680','height','270','wmode','transparent','src',src,'quality','high','flashVars','flashVariables='+flashVariables,'pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie',src );

	var l1 = '<noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" wmode="transparent" width="'+width+'" height="'+height+'">';

	var l2 = '<param name="movie" value="'+src+'.swf" /><param name="wmode" value="transparent" />';

	var l3 = '<param name="quality" value="high" />';

	var l4 = '<param name="allowScriptAccess" value="sameDomain" />';

	var l5 = '<param name="allowFullScreen" value="false" />';

	var l7 = '<param name="flashVars" value="flashVariables='+flashVariables+'">'

	var l8 = '<param name="salign" value="lt" />';

	var l9 = '<embed src="'+src+'.swf" flashVars="flashVariables='+flashVariables+'" quality="high" scale="noscale" salign="lt" bgcolor="#ffffff" width="100%" height="100%" name="master2" wmode="transparent" align="left" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';

	var l20 = '</object></noscript>';



	// write all lines

	document.write(l1+l2+l3+l4+l5+l7+l8+l9+l20);

}

function writeLeadSource(){
	var leadSource = document.getElementById("leadSource").value;
	document.getElementById("lead_source").value = leadSource;
}

function writeGoogleAnalytics(){
	document.write(document.getElementById("googleAnalytics").value);
}

function reqLaunch(page) {
	
popupWin = window.open("/pages/landingEmail.aspx?itemId="+ QueryString('ItemId') + "#Form");
}

function regLaunch(page) {
	if(QueryString('ItemId')){
		popupWin = window.open("/pages/formAssembly.aspx?itemId="+ QueryString('ItemId') + "#Form");
	}else{
		popupWin = window.open("/pages/formAssembly.aspx?itemId="+ QueryString('itemId') + "#Form");
	}
}


function repLaunch(page) {
/*
window.location = "/education/pages/landingEmail.aspx";
*/

if(document.getElementById("bodyText").style.display == "block"){
	document.getElementById("bodyText").style.display = "none";
	document.getElementById("formBody").style.display = "block";
}else{
	document.getElementById("bodyText").style.display = "block";
	document.getElementById("formBody").style.display = "none";
}
}


function Launch(page) { 
OpenWin = this.open(page, "KirupaStyle", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=700,height=600"); 
}

//popup Swf files
curPopSwf = 0;
function popSwf(file,fWidth, fHeight) {
curPopSwf = curPopSwf + 1; 
OpenWin = this.open("/pages/swfLoader.aspx?file=" + file + "&fWidth=" + fWidth + "&fHeight=" + fHeight, "SwfLoader" + curPopSwf, "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=" + fWidth + ",height=" + fHeight); 
} 
