	function funcInitiate()
	{
		for(iLoopInitial = 1; iLoopInitial < 35; iLoopInitial ++)
		{
			iBannerID = iLoopInitial + 1;
			strAddSpaceString 	= "<div id=\"item_"+iBannerID+"\">&nbsp;</div>";
			strAddSpaceString 	= strAddSpaceString + "<div id=\"item_"+iBannerID+"_space\" style=\"height:20px;\">&nbsp;</div>";
			document.getElementById("dvItems").innerHTML += strAddSpaceString;
			document.getElementById("item_"+iBannerID).style.display='none';
			document.getElementById("item_"+iBannerID+"_space").style.display='none';
		}
	}


// Function to delete selected Orders.
	function funcAddRemovePSDPrice(iBannerID)
	{
		var objForm 		= document.frmOrders;
		var objTextboxName 	= eval("objForm.txt_banner_price_item_" + iBannerID);
		var objCheckboxName = eval("objForm.chk_banner_psd_item_" + iBannerID);
		var iPSDPrice		= 5;
		var iBannerPrice	= parseFloat(objTextboxName.value);
		
		if(objCheckboxName.checked==true)
			var iBannerPSDPrice	= iBannerPrice + iPSDPrice;
		else
			var iBannerPSDPrice	= iBannerPrice - iPSDPrice;
		
		objTextboxName.value = iBannerPSDPrice.toFixed(2);
		funCalculateTotalPrice();
	}

	function funcAddMoreBanner(iFirstBannerPrice)
	{
		var strBannerString = "";
		var objForm 		= document.frmOrders;
		var iBannerCount 	= parseInt(objForm.hidBannerID.value);
		var iBannerTotalCount = parseInt(objForm.hidBannerCount.value);
		if(iBannerTotalCount >= 15)
		{
			alert("The maximum number of banners is 15. If you need more banners, please send another request after completing this.\n\nThanks");
			return false;
		}
		var iBannerID		= iBannerCount+1;
		
		strBannerString = strBannerString + "<div id=\"item_"+iBannerID+"\">";
		strBannerString = strBannerString + "<table cellpadding=\"0\" cellspacing=\"0\" class=\"banner_details\">";
		strBannerString = strBannerString + "<tr>";
		strBannerString = strBannerString + "<td width=\"120\" align=\"right\" nowrap>BANNER SIZE:&nbsp;</td>";
		strBannerString = strBannerString + "<td width=\"140\">"+getBannerSize(iBannerID)+"</td>";
		strBannerString = strBannerString + "<td width=\"120\"><select name=\"cbo_banner_type_item_"+iBannerID+"\" class=\"banner-textbox\" ><option value=\"ANIMATED\">ANIMATED</option><option value=\"STATIC\">STATIC</option></select></td>";
		strBannerString = strBannerString + "<td width=\"50\" nowrap>PSD&nbsp;<input type=\"checkbox\" onclick=\"funcAddRemovePSDPrice("+iBannerID+")\" name=\"chk_banner_psd_item_"+iBannerID+"\" value=\"1\" /></td>";
		strBannerString = strBannerString + "<td width=\"150\">&nbsp;&nbsp;PRICE:&nbsp;<input type=\"textbox\" name=\"txt_banner_price_item_"+iBannerID+"\" class=\"banner-textbox\" style=\"width:60px;\" value=\""+parseFloat(iFirstBannerPrice)+"\" /></td>";
		strBannerString = strBannerString + "<td width=\"60\"><input type=\"button\" name=\"btnRemoveBanner\" onclick=\"funcRemove('item_"+iBannerID+"');\" value=\"Remove\" /></td>";
		strBannerString = strBannerString + "</tr>";
		strBannerString = strBannerString + "<tr>";
		strBannerString = strBannerString + "<td align=\"right\"  style=\"padding-top:10px;\">DETAILS:&nbsp;</td>";
		strBannerString = strBannerString + "<td rowspan=\"2\" colspan=\"5\" valign=\"top\" style=\"padding-top:10px;\">";
		strBannerString = strBannerString + "<textarea class=\"banner-textbox\" name=\"txt_details_item_"+iBannerID+"\" rows=\"5\" cols=\"93\"></textarea>";
		strBannerString = strBannerString + "</td>";
		strBannerString = strBannerString + "</tr>";
		strBannerString = strBannerString + "<tr>";
		strBannerString = strBannerString + "<td style=\"font-size:10px;\">";
		strBannerString = strBannerString + "(Please provide the following information: <br />";
		strBannerString = strBannerString + "1. Site URL<br />";
		strBannerString = strBannerString + "2. Text to use on banner<br />";
		strBannerString = strBannerString + "3. Color Preference)";
		strBannerString = strBannerString + "</td>";
		strBannerString = strBannerString + "</tr>";
		strBannerString = strBannerString + "</table>";
		
		objForm.hidBannerID.value = iBannerID;
		objForm.hidBannerCount.value = parseInt(objForm.hidBannerCount.value) + 1;
		document.getElementById("spnBannerCount").innerHTML=objForm.hidBannerCount.value;
		document.getElementById("item_"+iBannerID).style.display='block';
		document.getElementById("item_"+iBannerID+"_space").style.display='block';
		document.getElementById("item_"+iBannerID).innerHTML = strBannerString;
		funCalculateTotalPrice();
	}
	
	function funcRemove(strID)
	{
		var objBanner = document.getElementById(strID);
		var objSpace  = document.getElementById(strID+"_space");
		var objForm   = document.frmOrders;
		objForm.hidBannerCount.value = parseInt(objForm.hidBannerCount.value) - 1;
		document.getElementById("spnBannerCount").innerHTML=objForm.hidBannerCount.value;
		
		objForm.hidRemovedBanners.value = objForm.hidRemovedBanners.value + strID + ",";
		objBanner.innerHTML = '&nbsp;';
		objBanner.style.display='none';
		objSpace.style.display='none';
		funCalculateTotalPrice();
	}
	
	function funCalculateTotalPrice()
	{
		var objForm 		= document.frmOrders;
		var iBannerCount 	= parseInt(objForm.hidBannerID.value);
		var iBannerTotalCount = parseInt(objForm.hidBannerCount.value);
		var strItemPrice, strTotalPrice;
		var objTextboxName;
		strTotalPrice = 0;
		
		for(iLoop = 1; iLoop <= iBannerCount; iLoop++)
		{
			var objBanner = document.getElementById("item_"+iLoop);
			
			if(objBanner.style.display=='none')
				continue;
			else
			{
				objTextboxName = eval("objForm.txt_banner_price_item_" + iLoop);
				strItemPrice = parseFloat(objTextboxName.value);
				strTotalPrice = parseFloat(strTotalPrice) + strItemPrice;
			}
		}

		var objCheckboxName = objForm.chkRush;
		var iRushPrice		= 12;
		
		if(objCheckboxName.checked==true)
			strTotalPrice	= parseFloat(strTotalPrice) + iRushPrice;

		objForm.txtTotalPrice.value = strTotalPrice.toFixed(2);
	}

/* Function to validate Order Form */
function validateOrderForm()
{
	var objForm 			= document.frmOrders;
	var strName				= objForm.txtName.value;
	var strEmail			= objForm.txtEmail.value;
	var strWebsite			= objForm.txtWebsite.value;
	var strSecurityCode		= objForm.code.value;
	
	var iBannerCount 		= parseInt(objForm.hidBannerID.value);
	var iBannerTotalCount 	= parseInt(objForm.hidBannerCount.value);
	var bReturn = true;
	
	if(funcTrim(strName) == "")
	{
		alert("Please enter name ");
		objForm.txtName.focus();
		return false;
	}
	
	if(funcTrim(strEmail) == "")
	{
		alert("Please enter your email");
		objForm.txtEmail.focus();
		return false;
	}
	else
	{
		if(funcIsEmail(strEmail)==false)
		{
			alert("Please enter a valid email");
			objForm.txtEmail.focus();
			return false;
		}
	}

	if(funcTrim(strWebsite) == "")
	{
		alert("Please enter website ");
		objForm.txtWebsite.focus();
		return false;
	}
	
	if(iBannerTotalCount == 0)
	{
		alert("Please add atleast one banner ");
		return false;
	}
	
	
	if(iBannerTotalCount > 0)
	{
		for(iLoop = 1; iLoop <= iBannerCount; iLoop++)
		{
			var objBanner = document.getElementById("item_"+iLoop);
			
			if(objBanner.style.display=='none')
				continue;
			else
			{
				objTextboxName = eval("objForm.txt_details_item_" + iLoop);
				if(funcTrim(objTextboxName.value) == "")
				{
					alert("Please enter details for Banner "+iLoop);
					objTextboxName.focus();
					return false;
				}
			}
		}
	}

	if(funcTrim(strSecurityCode) == "")
	{
		alert("Please enter security code ");
		objForm.code.focus();
		return false;
	}
	

	objForm.action = "submitBannerOrder.php";
	objForm.method = "post";
	objForm.submit();
}

/* Function to validate Order Form */
function validatePackageOrderForm()
{
	var objForm 			= document.frmOrders;
	var strName				= objForm.txtName.value;
	var strEmail			= objForm.txtEmail.value;
	var strWebsite			= objForm.txtWebsite.value;
	var strSecurityCode		= objForm.code.value;
	var objTextboxName 		= eval("objForm.txt_details_item_1");
	
	var bReturn = true;
	
	if(funcTrim(strName) == "")
	{
		alert("Please enter name ");
		objForm.txtName.focus();
		return false;
	}
	
	if(funcTrim(strEmail) == "")
	{
		alert("Please enter your email");
		objForm.txtEmail.focus();
		return false;
	}
	else
	{
		if(funcIsEmail(strEmail)==false)
		{
			alert("Please enter a valid email");
			objForm.txtEmail.focus();
			return false;
		}
	}

	if(funcTrim(strWebsite) == "")
	{
		alert("Please enter website ");
		objForm.txtWebsite.focus();
		return false;
	}
	
	
	if(funcTrim(objTextboxName.value) == "")
	{
		alert("Please enter details for Banners ");
		objTextboxName.focus();
		return false;
	}

	if(funcTrim(strSecurityCode) == "")
	{
		alert("Please enter security code ");
		objForm.code.focus();
		return false;
	}
	

	objForm.action = "submitBannerPackageOrder.php";
	objForm.method = "post";
	objForm.submit();
}


function funcTrim(paramString)
{
	var strString=new String(paramString);
	var strReturnText;
	strReturnText="";
	bNonBlankStarted=false;
	bNonBlankEnded=false;
	strIntermediateBlankChunk="";
	var iLoop;
	for(iLoop=0;iLoop<strString.length;iLoop++)
	{
		if(strString.charCodeAt(iLoop)!=32)
		{
			if(!bNonBlankStarted)
			{
				bNonBlankStarted=true;
			}
			if(bNonBlankStarted && !bNonBlankEnded)
			{
				strReturnText+=strString.charAt(iLoop);
			}
			if(bNonBlankEnded)
			{
				strReturnText+=(strIntermediateBlankChunk+strString.charAt(iLoop));
				bNonBlankEnded=false;
				strIntermediateBlankChunk="";
			}
		}
		else
		{
			if(bNonBlankStarted)
			{
				bNonBlankEnded=true;
				strIntermediateBlankChunk+=" ";
			}
		}
	}
	return strReturnText;
}


function funcIsEmail(str_param_email)
{
	var str_current_character;
	var b_valid_email,b_period_present; 
	var i_last_position_of_period,b_correct_length_extension;
	var i_num_at_symbol=0;
	var i_pos_at_symbol;
	var i_length_of_server_name=1;
	var i_pos_consecutive_dots;
	var str_email=new String(funcTrim(str_param_email));
	i_length=str_email.length;
	b_period_present=1;
	b_correct_length_extension=1;
	i_last_position_of_period=0;
	
	if(i_length==0)
	{
		return true;
	}
	
	for(i_loop=0; i_loop<i_length; i_loop++)
	{
		if(!((str_email.charCodeAt(i_loop)>=65 && str_email.charCodeAt(i_loop)<=90)
		  || (str_email.charCodeAt(i_loop)>=97 && str_email.charCodeAt(i_loop)<=122)
		  || (str_email.charCodeAt(i_loop)>=48 && str_email.charCodeAt(i_loop)<=57)
		  || (str_email.charAt(i_loop)=="@")
		  || (str_email.charAt(i_loop)=="_")
		  || (str_email.charAt(i_loop)=="-")
		  || (str_email.charAt(i_loop)==".")))
		{
			return false;
		}
	}
	
	i_pos_consecutive_dots=str_email.indexOf('..');
	if(i_pos_consecutive_dots!=-1)
	{
		return false;
	}
	
	var i_pos_space;
	i_pos_space = str_email.indexOf(' ');
	if(i_pos_space!=-1)
	{
		return false;
	}
	
	i_last_position_of_period = str_email.lastIndexOf('.');
	if(i_last_position_of_period<=0)
	{
		b_period_present=0;
	}
	
	if(((i_length-i_last_position_of_period)>5) || ((i_length-i_last_position_of_period)<3))
	{
		b_correct_length_extension=0;
	}
	
	for(i_loop=0;i_loop<=i_length;i_loop++)
	{
		str_current_character=str_email.charAt(i_loop);
		if (str_current_character=='@')
		{
			i_num_at_symbol=i_num_at_symbol + 1;
		}
	}
	
	if(i_num_at_symbol!=1)
	{
		return false;
	}
	
	i_pos_at_symbol = str_email.indexOf('@');
	if(str_email.charAt(i_pos_at_symbol+1) == '.')
	{
		i_length_of_server_name=0;
	}
	
	if((i_num_at_symbol==1) && (b_period_present==1) && (b_correct_length_extension==1) && (i_length_of_server_name==1))
	{
		b_valid_email=1;
	}
	else
	{
		 b_valid_email=0;
	}
	
	if(b_valid_email==0)
	{
		return false;
	}
	else
	{
		return true;
	}
}


function validateContact()
{
	var objForm 			= document.frmContactUs;
	var strName				= objForm.txtName.value;
	var strEmail			= objForm.txtEmail.value;
	var strSubject			= objForm.txtSubject.value;
	var strMessage			= objForm.txtMessage.value;
	var strCode				= objForm.code.value;

	if(funcTrim(strName) == "")
	{
		alert("Please enter name ");
		objForm.txtName.focus();
		return false;
	}
	
	if(funcTrim(strEmail) == "")
	{
		alert("Please enter your email");
		objForm.txtEmail.focus();
		return false;
	}
	else
	{
		if(funcIsEmail(strEmail)==false)
		{
			alert("Please enter a valid email");
			objForm.txtEmail.focus();
			return false;
		}
	}

	if(funcTrim(strSubject) == "")
	{
		alert("Please enter subject ");
		objForm.txtSubject.focus();
		return false;
	}

	if(funcTrim(strMessage) == "")
	{
		alert("Please enter your message ");
		objForm.txtMessage.focus();
		return false;
	}
	
	if(funcTrim(strCode) == "")
	{
		alert("Please enter security code ");
		objForm.code.focus();
		return false;
	}
}