/*****************************
Module name : js_functions.js
Return type : string
Date created : 11th April 2008
Date last modified : 11th April 2008
Author : Icreon Communications
Comments : This file contains js related validation functions.
************************************/

/*****************************
Function name : show
Return type : string
Date created : 7th April 2008
Date last modified : 7th April 2008
Author : Icreon Communications
Comments : This function is used to show hide div related to id.
User instruction : show(strVal)
************************************/
function show(strVal)
{
	if(strVal == 'new')
	{
		document.getElementById('new').style.display='inline';
		document.getElementById('exist').style.display='none';
	}
	else
	{
		document.getElementById('new').style.display='none';
		document.getElementById('exist').style.display='inline';
	}
}

/*****************************
Function name : validateWorldCupRegisterForms
Return type : string
Date created : 11th April 2008
Date last modified : 11th April 2008
Author : Icreon Communications
Comments : This function is used to validate the world cup modules registeration froms.
User instruction : validateWorldCupRegisterForms()
************************************/
function validateWorldCupRegisterForms()
{
		
		var msg='';
		var matchUrl = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
		var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var varFname	=	document.formRegister.first_name.value;
		var varLname	=	document.formRegister.last_name.value;
		var varAge	=	document.formRegister.SeoParticipantAge.value;
		var varGender	=	document.formRegister.SeoParticipantGender.value;
		var varCountry		=	document.formRegister.SeoParticipantCountry.value;
		var varEmail		=	document.formRegister.email.value;
		var varUsername =	document.formRegister.username.value;
		var varUserPassword =	document.formRegister.password.value;
		var varCPassword =	document.formRegister.confirmpass.value;
	
	
		if(varFname == '')
		{
			msg+="-> First name is required.\n";
		}
		if(varLname == '')
		{
			msg+="-> Last name is required.\n";
		}
		if(varAge == '')
		{
			msg+="-> Age is required.\n";
		}
		if(varGender == '')
		{
			msg+="-> Gender is required.\n";
		}
		if(varCountry == '')
		{
			msg+="-> Country is required.\n";
		}
		if(varEmail == '')
		{
			msg+="-> Email-ID is required.\n";
		}
		if((!regEmail.test(varEmail))&&(varEmail!=''))
		{
			msg+="-> Please enter email-id in valid format.\n";
		}
		if(varUsername == '')
		{
			msg+="-> Username is required.\n";
		}
		if(varUserPassword == '')
		{
			msg+="-> Password is required.\n";
		}
		if(varCPassword == '')
		{
			msg+="-> Confirm password is required.\n";
		}
		if(document.formRegister.regRules.checked == false)
		{
			msg+="-> Please read our rules before registering in to our this section.\n";
		}
		
	
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

/*****************************
Function name : validateWorldCupLoginForm
Return type : string
Date created : 11th April 2008
Date last modified : 11th April 2008
Author : Icreon Communications
Comments : This function is used to world cup login froms.
User instruction : validateWorldCupLoginForm(varChkVal)
************************************/
function validateWorldCupLoginForm()
{
		
		var msg='';
		var varUser=	document.formRegister.user.value;
		var varPassword =	document.formRegister.pass.value;
		if(varUser == '')
		{
			msg+="-> Username is required.\n";
		}

		if(varPassword == '')
		{
			msg+="-> Password is required.\n";
		}
		if(document.formRegister.loginRules.checked == false)
		{
			msg+="-> Please read our rules before registering in to our this section.\n";
		}
		
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

/*****************************
Function name : validateInvitationForm
Return type : string
Date created : 29th April 2008
Date last modified : 29th April 2008
Author : Icreon Communications
Comments : This function is used to validate the friend invitation froms.
User instruction : validateInvitationForm()
************************************/
function validateInvitationForm()
{
		var msg='';
		var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var varYourName =	document.emailform.first_name.value;
		var varFriendName =	document.emailform.friend_name.value;
		var varYourEmail =	document.emailform.my_email.value;
		var varFriendemail =	document.emailform.friend_email.value;

		if(varYourName == '')
		{
			msg+="-> Your name is required.\n";
		}

		if(varFriendName == '')
		{
			msg+="-> Friend name is required.\n";
		}
		if(varYourEmail == '')
		{
			msg+="-> Your email-id is required.\n";
		}
		if((!regEmail.test(varYourEmail))&&(varYourEmail!=''))
		{
			msg+="-> Please enter your email-id in valid format.\n";
		}
		if(varFriendemail == '')
		{
			msg+="-> Friend email-id is required.\n";
		}
		if((!regEmail.test(varFriendemail))&&(varFriendemail!=''))
		{
			msg+="-> Please enter friend email-id in valid format.\n";
		}
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

/*****************************
Function name : validateDesignUploadForms
Return type : string
Date created : 29th April 2008
Date last modified : 29th April 2008
Author : Icreon Communications
Comments : This function is used to validate world cup upload design form.
User instruction : validateDesignUploadForms()
************************************/
function validateDesignUploadForms()
{
 
		
		var msg='';
		extArray = new Array(".jpg", ".gif",".jpeg",".png");
		var varTitle =	document.getElementById('UploadDesignDesigntitle').value;
		var file =	document.getElementById('UploadDesignUploadfile').value;
		var varComments =	document.getElementById('UploadDesignComments').value;
		
	

		if(varTitle == '')
		{
			msg+="-> Title is required.\n";
		}
		
		if (file == '') 
		{
			msg+="-> Uploadable is required.\n";
		}

		var allowSubmit = false;
 
		 var allowSubmit = false;
		 if(file!='')
		 {
			 while (file.indexOf("\\") != -1)
			 file = file.slice(file.indexOf("\\") + 1);
			 ext = file.slice(file.indexOf(".")).toLowerCase();
			 for (var i = 0; i < extArray.length; i++) {
			 if (extArray[i] == ext) { allowSubmit = true; break; }
			 }
			 
			 if (allowSubmit==false) 
			  {
			  msg+="-> can be upload files that end in types: "
			 + (extArray.join(" ")) + "\nPlease select a new.\n";
			 } 
		 
		 }
	
		if(varComments == '')
		{
			msg+="-> Why design should win is required.\n";
		}
		
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

/*****************************
Function name : validateWorldCupLoginForms
Return type : string
Date created : 29th April 2008
Date last modified : 29th April 2008
Author : Icreon Communications
Comments : This function is used to validate world cup login form.
User instruction : validateWorldCupLoginForms()
************************************/
function validateWorldCupLoginForms()
{
		
		
		var msg='';
		var varUsername =	document.getElementById('SeoParticipantUsername').value;
		var varPassword =	document.getElementById('SeoParticipantPassword').value;
			

		if(varUsername == '')
		{
			msg+="-> Username is required.\n";
		}

		if(varPassword == '')
		{
			msg+="-> Password is required.\n";
		}
		
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

/*****************************
Function name : validateUrlForms
Return type : string
Date created : 29th April 2008
Date last modified : 29th April 2008
Author : Icreon Communications
Comments : This function is used to validate seo upload url form.
User instruction : validateUrlForms()
************************************/
function validateUrlForms()
{
 
		
		var msg='';
		var matchUrl = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
		var file =	document.getElementById('UploadDesignUploadfile').value;
		var varComments =	document.getElementById('UploadDesignComments').value;
		
		if (file == '') 
		{
			msg+="-> Uploadable url is required.\n";
		}
		
		if((!matchUrl.test(file))&&(file!=''))
		{
			msg+="-> Please enter url in valid format.\n";
		}

		if(varComments == '')
		{
			msg+="-> Why url should win is required.\n";
		}
		
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

function goLogout()
{
	location.href='index.php?/logout';
}

function changePassword()
{
	location.href='index.php?/changepassword';
}
function goUploadUrl()
{
	location.href='index.php?/uploadurl';
}
function goUploadDesign()
{
	location.href='index.php?/uploaddesign';
}
function goUploadedUrl()
{
	location.href='index.php?/uploadedurls';
}
function goUploadedDesign()
{
	location.href='index.php?/uploadeddesigns';
}
function goLoginUrl()
{
	location.href='index.php?/worldcuplogin';
}
function goForgotPasswordUrl()
{
	location.href='index.php?/forgotpassword';
}
function openWindow(img)
{
	
		var homeUrl = 'http://localhost/BusbyWebsolutions/busby/';
		//var homeUrl = 'http://www.busbywebsolutions.com/';
		window.open(homeUrl+"openwin.php?image="+img,"Busby","width=400,height=400,toolbars=yes,scrollbars=yes,statusbars=yes");	
}

/*****************************
Function name : validateSeoReportForms
Return type : string
Date created : 11th April 2008
Date last modified : 11th April 2008
Author : Icreon Communications
Comments : This function is used to validate the SEO generate form.
User instruction : validateSeoReportForms()
************************************/
function validateSeoreportForms()
{
	
		var msg='';
		var matchUrl = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
		var regEmail		= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var varName		=	document.getElementById('SeoreportName').value;
		var varEmail		=	document.getElementById('SeoreportEmail').value;
		var varLocation	=	document.getElementById('SeoreportLocation').value;
		var varContact	=	document.getElementById('SeoreportContact').value;
		var varUrl	=	document.getElementById('SeoreportUrl').value;
		

		if(varName == '')
		{
			msg+="-> Name is required.\n";
		}

		if(varEmail == '')
		{
			msg+="-> Email-id is required.\n";
		}
		if((!regEmail.test(varEmail))&&(varEmail!=''))
		{
			msg+="-> Please enter your email-id in valid format.\n";
		}
		if(varLocation == '')
		{
			msg+="-> Location is required.\n";
		}
		if(varContact == '')
		{
			msg+="-> Contact phone is required.\n";
		}
		if(varUrl == '')
		{
			msg+="-> Url is required.\n";
		}
		if((!matchUrl.test(varUrl))&&(varUrl!=''))
		{
			msg+="-> Please enter url in valid format.\n";
		}
		
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

function addCompetitor()
{
	if(document.getElementById("Competitor1").style.display == 'block')
	{
		document.getElementById("Competitor2").style.display = 'block';
	}
	document.getElementById("Competitor1").style.display = 'block';
}

function addKeyword()
{
	if(document.getElementById("keyword_1").style.display == 'block')
	{
		document.getElementById("keyword_2").style.display = 'block';
	}
	document.getElementById("keyword_1").style.display = 'block';
}

function updateTextField(value)
{
	document.SeoReportForm.keywordTag.value = value;
}


function addMoreKeywords()
{
	
	var obj = document.getElementById("SeoReportForm");
	obj.totalDiv.value = parseInt(obj.totalDiv.value) + 1;
	var newVal = obj.totalDiv.value;
	
	if(newVal <=3)
	{
	var content = '<div id="id_'+newVal+'"  ><br/><input name="keyword_phrase[]" type="text" size="40" />&nbsp;&nbsp;<a href="javascript: removeMoreFile('+newVal+');">Remove</a></div>';
	document.getElementById("moreFile").style.display = "block";
	dynamiccontentNS6("moreFile", content);
	}
}

function addMoreUrl()
{
	
	var obj = document.getElementById("SeoReportForm");
	obj.totalDivUrl.value = parseInt(obj.totalDivUrl.value) + 1;
	var newVal = obj.totalDivUrl.value;
	
	if(newVal <=5)
	{
	var content = '<div id="id_'+newVal+'"  ><br/><input name="competitor_url[]" type="text" size="40" />&nbsp;&nbsp;<a href="javascript: removeMoreUrl('+newVal+');">Remove</a></div>';
	document.getElementById("moreUrl").style.display = "block";
	dynamiccontentNS6url("moreUrl", content);
	}
}

function removeMoreFile(id)
{

		var obj = document.getElementById("SeoReportForm");
	
	obj.packageCountCheck.value = parseInt(obj.packageCountCheck.value) - 1;	
	
	document.getElementById('id_'+id).style.display = 'none';
	document.getElementById('id_'+id).innerHTML = '';
}
function removeMoreUrl(id)
{
		var obj = document.getElementById("SeoReportForm");
	
	obj.packageCountUrl.value = parseInt(obj.packageCountUrl.value) - 1;	
	
	document.getElementById('id_'+id).style.display = 'none';
	document.getElementById('id_'+id).innerHTML = '';
}

function dynamiccontentNS6url(elementid, content)
{
	if(document.all)
	{
		el = document.getElementById(elementid);
		el.innerHTML += content;
	}
	else if(document.getElementById)
	{
		rng = document.createRange();
		el = document.getElementById(elementid);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content);
		el.appendChild(htmlFrag);
	}
}

function dynamiccontentNS6(elementid, content)
{
	if(document.all)
	{
		el = document.getElementById(elementid);
		el.innerHTML += content;
	}
	else if(document.getElementById)
	{
		rng = document.createRange();
		el = document.getElementById(elementid);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content);
		el.appendChild(htmlFrag);
	}
}

function submitpage(argVal)
{
	var frm = document.paging;
	frm.page.value = argVal;
	frm.submit();
}

function openForgotWindow()
{
	
		var homeUrl = 'http://localhost/BusbyWebsolutions/busby/';
		//var homeUrl = 'http://www.busbywebsolutions.com/';
		window.open(homeUrl+"open_forgot_win.php","Busby","width=500,height=250,top=300,left=250,toolbars=yes,scrollbars=no,statusbars=yes, valign=middle");	
}

function validateForgotPassForm()
{
		
		var msg='';
		var regEmail		= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var varUsername =	document.getElementById('SeoParticipantEmail').value;
		if(varUsername == '')
		{
			msg+="-> Email-id is required.\n";
		}
		if((!regEmail.test(varUsername))&&(varUsername!=''))
		{
			msg+="-> Please enter your email-id in valid format.\n";
		}
		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

function validateChangePassForm()
{
		
		var msg='';
		
		var varOldPass =	document.getElementById('SeoParticipantPassword').value;
		var varNewPass =	document.getElementById('SeoParticipantNewpassword').value;
		var varConfPass =	document.getElementById('SeoParticipantConfirmpass').value;

		if(varOldPass == '')
		{
			msg+="-> Old password is required.\n";
		}

		if(varNewPass == '')
		{
			msg+="-> New password is required.\n";
		}

		if(varConfPass == '')
		{
			msg+="-> Confirm password is required.\n";
		}
		
		if(varConfPass != varNewPass)
		{
			msg+="-> New OR Confirm password must be same.\n";
		}

		if(msg!='')
		{
		  message="Sorry ! We cannot complete your request.\nKindly provide us the missing or incorrect information : \n";
		  comp_msg = message+msg;
		  alert(comp_msg);
		  return false;
		}
		 else
		{ 
		  return true;
		}
}

function closeme()
{
	window.close();
}

//for rent now page
function loadThemes(industry_id)
{
	document.theme_display.mode.value = 'loadThemes';	
	document.theme_display.industry_id.value = industry_id;	
	document.theme_display.domainname.value = document.getElementById("domainname").value;
	
	if(document.websitepromotion['themes[]'] != undefined)
	{
		var a=document.websitepromotion['themes[]'];
		var checkbox_vals = '';
		var p = 0;
		for(i=0;i<a.length;i++)
		{
			if(a[i].checked)
			{
				checkbox_vals = checkbox_vals + a[i].value + ",";
				p = 1;
			}
		}
		if(p == 1)
		{
			checkbox_vals = checkbox_vals.substr(0,checkbox_vals.length-1);
		}
		document.theme_display.array_themes.value = checkbox_vals;
	}
	
	if(document.getElementById("custom_design").checked)
		custom_design = 1;
	else
		custom_design = 0;

	document.theme_display.custom_design.value = custom_design;
		
	document.theme_display.currency.value = document.getElementById("websitepromotionCurrency").value;
	
	document.theme_display.package_type.value = document.getElementById("websitepromotionPackageType").value;

	document.theme_display.hosting_type.value = document.getElementById("websitepromotionHostingType").value;

	document.theme_display.country.value = document.getElementById("websitepromotionCountry").value;

	if(document.getElementById("statistics_package").checked)
		statistics_package = 1;
	else
		statistics_package = 0;

	if(document.getElementById("seo_package").checked)
		seo_package = 1;
	else
		seo_package = 0;

	if(document.getElementById("assistance_setting").checked)
		assistance_setting = 1;
	else
		assistance_setting = 0;

	document.theme_display.statistics_package.value = statistics_package;

	document.theme_display.seo_package.value = seo_package;
	
	document.theme_display.assistance_setting.value = assistance_setting;

	document.theme_display.submit();
}

function updateHostingDetails(hosting)
{
	if(hosting == 1)
		$("#hosting_info").html('2.5GB bandwidth, 0.5GB disk space, 20 mail boxes');
	else if(hosting == 2)
		$("#hosting_info").html('5GB bandwidth, 1GB disk space, 50 mail boxes');
	else if(hosting == 3)
		$("#hosting_info").html('7.5GB bandwidth, 2GB disk space, 100 mail boxes');
	else if(hosting == 4)
		$("#hosting_info").html('15GB bandwidth, 5GB disk space, 200 mail boxes');
	else
		$("#hosting_info").html('');
	
	updateRentalDetails();
		
}
function updatePackageDetails(package_id,strMode)
{
	if(package_id == 1)
		$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/easycontentmanagement" target="_blank">here</a> to see');
	else if(package_id == 2)
		$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/advancedcontentmanagement" target="_blank">here</a> to see');
	else if(package_id == 3)
		$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/easyshopping" target="_blank">here</a> to see');
	else if(package_id == 4)
		$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/advancedshopping" target="_blank">here</a> to see');
	else
		$("#package_info").html('');

	updateRentalDetails();
}

function checkFormDetails()
{
	if(document.getElementById("websitepromotionIndustryType").value== 0)
	{
		alert("Please select your industry.");
		document.getElementById("websitepromotionIndustryType").focus();
		return false;
	}

	if(document.getElementById("websitepromotionPackageType").value== 0)
	{
		alert("Please select your package");
		document.getElementById("websitepromotionPackageType").focus();
		return false;
	}

	if(document.getElementById("websitepromotionHostingType").value== 0)
	{
		alert("Please select your hosting");
		document.getElementById("websitepromotionHostingType").focus();
		return false;
	}

	if(document.getElementById("websitepromotionCountry").value== 0)
	{
		alert("Please select your country location");
		document.getElementById("websitepromotionCountry").focus();
		return false;
	}	

	if(!document.getElementById("terms_and_condition").checked)
	{
		alert("You need to accept our terms and conditions.");
		document.getElementById("terms_and_condition").focus();
		return false;
	}

	return true;
	//document.websitepromotion.submit();
}
			
function updateRentalDetails()
{
	document.getElementById("defulat_display_procces").style.display = 'none';
	document.getElementById("display_procces").style.display = 'block';
	curr		= document.getElementById("websitepromotionCurrency").value;
	package_id  = document.getElementById("websitepromotionPackageType").value;
	hosting_id  = document.getElementById("websitepromotionHostingType").value;
	
	if(document.getElementById("statistics_package").checked)
		statistics_package = 1;
	else
		statistics_package = 0;

	if(document.getElementById("seo_package").checked)
		seo_package = 1;
	else
		seo_package = 0;
	
	if(document.getElementById("custom_design").checked)
		custom_design = 1;
	else
		custom_design = 0;

	$.ajax({
	   type: "POST",
	   url: "index.php?/rentnow",
	   data: "mode=ajaxRentalPackage&currency_type="+curr+"&hosting_id="+hosting_id+"&package_id="+package_id+"&statistics_package="+statistics_package+"&seo_package="+seo_package+"&custom_design="+custom_design,
	   success: function(msg){
		   if(msg != '')
		   {
			   getPirce = msg.split("_");
			   document.getElementById("package_price").value = getPirce[0];
			   document.getElementById("hosting_price").value = getPirce[1];
			   document.getElementById("setup_price").value = getPirce[2];
			   $("#statistics_price").html(getPirce[3]);
			   $("#seo_price").html(getPirce[4]);	
			   $("#total_price").html(getPirce[5]);
			   $("#monthly_price").html(getPirce[6]);
			   $("#assistance_setting_info").html(getPirce[7]);
			   $("#custom_desing_info").html(getPirce[8]);
			   document.getElementById("display_procces").style.display = 'none';
			   document.getElementById("defulat_display_procces").style.display = 'block';
		   }
	   }
	 });
}

function changeTheme(strVal)
{
	var industry_id = document.getElementById("websitepromotionIndustryType").value;
	if(strVal != 0 && industry_id != 0)
	{
		loadThemes(industry_id);
	}else
		updatePackageDetails(strVal);
}

var allDialogs = [];
function create(options,mode) 
{
	if(mode == 1)
	  {
		dialogTitle = 'Site statistics';
		dialogMessage = 'Have access to all the latest information on unique visitors, time spent on site, bounce rate, pages visited, and location of your visitors, source of visitors and much more.';
	  }else
	  {
		dialogTitle = 'SEO';
		dialogMessage = 'One off manual submission to Google, Yahoo, MSN, DMOZ as well as 5 unique directory listings per month.';	
	  }
	options = $.extend({title: dialogTitle}, options || {});
	var dialog = new Boxy("<div><p>"+dialogMessage+"</p></div>", options);
	allDialogs.push(dialog);
	return false;
}

//for demo tour page
function loadThemesImages(industry_id)
			{
				document.theme_display.mode.value = 'loadThemes';	
				document.theme_display.industry_id.value = industry_id;	
				document.theme_display.domainname.value = document.getElementById("domainname").value;
				
				document.theme_display.package_type.value = document.getElementById("TrialdemoPackageType").value;

				document.theme_display.country.value = document.getElementById("TrialdemoCountry").value;

				document.theme_display.companyname.value = document.getElementById("companyname").value;
				document.theme_display.contactname.value = document.getElementById("contactname").value;
				document.theme_display.email.value = document.getElementById("email").value;
				document.theme_display.phone.value = document.getElementById("phone").value;
				document.theme_display.level_of_interest.value = document.getElementById("TrialdemoLevelOfInterest").value;
				document.theme_display.launch_date.value = document.getElementById("TrialdemoLaunchDate").value;
				document.theme_display.domain_extension.value = document.getElementById("TrialdemoDomainExtension").value;
				
				if(document.Trialdemo['themes[]'] != undefined)
				{
					var a=document.Trialdemo['themes[]'];
					var checkbox_vals = '';
					var p = 0;
					for(i=0;i<a.length;i++)
					{
						if(a[i].checked)
						{
							checkbox_vals = checkbox_vals + a[i].value + ",";
							p = 1;
						}
					}
					if(p == 1)
					{
						checkbox_vals = checkbox_vals.substr(0,checkbox_vals.length-1);
					}
					document.theme_display.array_themes.value = checkbox_vals;
				}

				if(document.getElementById("assistance_setting").checked)
					assistance_setting = 1;
				else
					assistance_setting = 0;
				
				document.theme_display.assistance_setting.value = assistance_setting;

				document.theme_display.submit();
			}
			
			function changeThemes(package_id)
			{
				var industry_id = document.getElementById("TrialdemoIndustryType").value;
				if(package_id != 0 && industry_id != 0)
				{
					loadThemesImages(industry_id);
				}else
				{
					updatePackageInfo(package_id);
				}
			}
			function updatePackageInfo(package_id)
			{
				if(package_id == 1)
					$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/easycontentmanagement" target="_blank">here</a> to see');
				else if(package_id == 2)
					$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/advancedcontentmanagement" target="_blank">here</a> to see');
				else if(package_id == 3)
					$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/easyshopping" target="_blank">here</a> to see');
				else if(package_id == 4)
					$("#package_info").html('Need more details of this package? click <a href="http://www.busbywebsolutions.com/index.php?/advancedshopping" target="_blank">here</a> to see');
				else
					$("#package_info").html('');
			}
			
			function checkDomain()
			{
				   domainname = document.getElementById("domainname").value;
				   extension = document.getElementById("TrialdemoDomainExtension").value;
				   if(domainname != '')
				   {
					   $("#display_procces").html('Please wait...');
					   document.getElementById("display_procces").style.display = 'block';
					   $.ajax({
					   type: "POST",
					   url: "index.php?/checkdomain",
					   data: "domain="+domainname+"&extension="+extension,
					   success: function(msg)
					   {
						   $("#display_procces").html(msg);
					   }
					 });
				   }else
				   {
					   alert("Please enter your domain name.");
						document.getElementById("domainname").focus();
						return false;
				   }
					
			}

