/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/various/more.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

var price=0;
function Show_image()
{
		if (document.getElementById('order_detail_div').style.display=='')
		{
			document.getElementById('showminus').style.display='none';
			document.getElementById('showimage').style.display='';
			document.getElementById('showimage_id').style.display='';
			document.getElementById('hide_image').style.display='none';
		}
		else
		{
			document.getElementById('showimage_id').style.display='none';
			document.getElementById('hide_image').style.display='';
			document.getElementById('showminus').style.display='';
			document.getElementById('showimage').style.display='none';
		}
}
function advance_markup_option()
{
		if (document.getElementById('advance_markup_option').style.display=='')
		{
			document.getElementById('showminus_s').style.display='none';
			document.getElementById('showimage_s').style.display='';
			document.getElementById('second_showimage_id').style.display='';
			document.getElementById('second_hide_image').style.display='none';
		}
		else
		{
			document.getElementById('second_showimage_id').style.display='none';
			document.getElementById('second_hide_image').style.display='';
			document.getElementById('showminus_s').style.display='';
			document.getElementById('showimage_s').style.display='none';
		}
}
function price_calculate()
{
	
	//alert(document.getElementById(coupan_percent).value);
	var lay_width			= 0;
	var horizotal_align		= 0;
	var vartical_align		= 0;
	var footer_at_bootom	= 0;
	var opera_camptibality	= 0;
	var safri_google		= 0;
	var wysiwg				= 0;
	var dynamic_rollover	= 0;
	var dynamic_menu		= 0;
	var resizeable_fonts	= 0;
	var sIFR				= 0;
	var css_options			= 0;
	var commented			= 0;
	var coding_option		= 0;
	var tabless_coding		= 0;
	
	var seo_sementic		= 0;
	var optimize_load		= 0;
	var implement_ssi		= 0;
	var print_virsion		= 0;
	var typeofweb			= 0;
	var coupan_percent		= document.getElementById("coupan_percent").value;
	
	for( i = 0; i < document.order_now._input_l_em_based.length; i++ )
	{
		if( document.order_now._input_l_em_based[i].checked == true )
		em_based = document.order_now._input_l_em_based[i].value;
	}
	for( i = 0; i < document.order_now.typeofweb.length; i++ )
	{
		if( document.order_now.typeofweb[i].checked == true )
		typeofweb = document.order_now.typeofweb[i].value;
	}
	
	
	for( i = 0; i < document.order_now._input_cd_ssi.length; i++ )
	{
		if( document.order_now._input_cd_ssi[i].checked == true )
		implement_ssi = document.order_now._input_cd_ssi[i].value;
	}


	
	
	for( i = 0; i < document.order_now._input_d_menu.length; i++ )
	{
		if( document.order_now._input_d_menu[i].checked == true )
		dynamic_menu = document.order_now._input_d_menu[i].value;
	}
	

	
	for( i = 0; i < document.order_now._input_f_sifr.length; i++ )
	{
		if( document.order_now._input_f_sifr[i].checked == true )
		sIFR = document.order_now._input_f_sifr[i].value;
	}
	

	
	for( i = 0; i < document.order_now._input_css_commented.length; i++ )
	{
		if( document.order_now._input_css_commented[i].checked == true )
		commented = document.order_now._input_css_commented[i].value;
	}
	

	
	for( i = 0; i < document.order_now._input_cd_seo.length; i++ )
	{
		if( document.order_now._input_cd_seo[i].checked == true )
		seo_sementic = document.order_now._input_cd_seo[i].value;
	}
	
	

	for( i = 0; i < document.order_now._input_cd_print_version_css.length; i++ )
	{
		if( document.order_now._input_cd_print_version_css[i].checked == true )
		print_virsion = document.order_now._input_cd_print_version_css[i].value;
	}
	pages	= parseInt(document.order_now.mainpages.value, 10);	
	pages	= parseInt(pages, 10);
	//alert(typeof(pages));
	//alert(pages);
	if(pages==1||pages==0||pages=='')
			{
				value = parseInt(typeofweb,10);
			}
			else
			{
					//alert(price);
				value = parseInt(typeofweb,10)*(parseInt(pages,10));
					
				value =parseInt(value)
			}
	subpages = document.order_now.subpages.value;
	
	if(subpages==0||subpages=='')
			{
				subvalue = 0;
			}
			else
			{
					//alert(price);
				subvalue = (parseInt(typeofweb,10)/2)*(parseInt(subpages,10));
					
				subvalue =parseInt(subvalue)
			}
	
		//alert("value is"+implement_ssi);
	
	price= parseInt(lay_width,10)+parseInt(horizotal_align,10)+parseInt(vartical_align,10)+parseInt(footer_at_bootom,10)+parseInt(em_based,10)+parseInt(opera_camptibality,10)+parseInt(safri_google,10)+parseInt(wysiwg,10)+parseInt(dynamic_rollover,10)+parseInt(dynamic_menu,10)+parseInt(resizeable_fonts,10)+parseInt(sIFR,10)+parseInt(css_options,10)+parseInt(commented,10)+parseInt(coding_option,10)+parseInt(tabless_coding,10)+parseInt(seo_sementic,10)+parseInt(optimize_load,10)+parseInt(implement_ssi,10)+parseInt(print_virsion,10);
	
	totalprice = parseInt(value,10)+parseInt(price,10)+parseInt(subvalue,10);
	//alert("totalprice is"+totalprice);
	if(coupan_percent != '0')
	{
	totalprice = totalprice - (totalprice * coupan_percent)/100;
	}
	//alert("price with coupan is "+totalprice);
	document.getElementById("price1").innerHTML  = parseInt(totalprice,10);
	document.order_now.price_value.value = parseInt(totalprice,10);
	
		
}

/*function no_pages()
{	
	var value=0;
	value_integer = 1;
		pages	= document.order_now.mainpages.value;
		subpages	= document.order_now.subpages.value;
		/* for (var i = 0; i < pages.length; i++) 
		{
			var ch = pages.charAt(i)
			if (i == 0 && ch == "-")
			{
				continue
			}
			if (ch < "0" || ch > "9")
			{
				value_integer = 0
			}
		}
		if(value_integer==0)
		{
			document.getElementById('mainpagesmessage').show();
			document.getElementById('mainpagesmessage').innerHTML  = "<font color='red'>Number of pages should numeric</font>";
			document.getElementById('no_pages').style.display='';
			document.order_now.pages.focus();
			//alert('Please enter integer value only in pages field');
		}
			var lay_width			= 0;
			var horizotal_align		= 0;
			var vartical_align		= 0;
			var footer_at_bootom	= 0;
			var opera_camptibality	= 0;
			var safri_google		= 0;
			var wysiwg				= 0;
			var dynamic_rollover	= 0;
			var dynamic_menu		= 0;
			var resizeable_fonts	= 0;
			var sIFR				= 0;
			var css_options			= 0;
			var commented			= 0;
			var coding_option		= 0;
			var tabless_coding		= 0;
			
			var seo_sementic		= 0;
			var optimize_load		= 0;
			var implement_ssi		= 0;
			var print_virsion		= 0;
			var typeofweb			=0;
			
			for( i = 0; i < document.order_now.typeofweb.length; i++ )
			{
				if( document.order_now.typeofweb[i].checked == true )
					typeofweb = document.order_now.typeofweb[i].value;
			}
			
			
			for( i = 0; i < document.order_now._input_l_em_based.length; i++ )
			{
			if( document.order_now._input_l_em_based[i].checked == true )
			em_based = document.order_now._input_l_em_based[i].value;
			}
			
			
			for( i = 0; i < document.order_now._input_d_menu.length; i++ )
			{
			if( document.order_now._input_d_menu[i].checked == true )
			dynamic_menu = document.order_now._input_d_menu[i].value;
			}
			
			for( i = 0; i < document.order_now._input_f_sifr.length; i++ )
			{
			if( document.order_now._input_f_sifr[i].checked == true )
			sIFR = document.order_now._input_f_sifr[i].value;
			}
			
			for( i = 0; i < document.order_now._input_css_commented.length; i++ )
			{
			if( document.order_now._input_css_commented[i].checked == true )
			commented = document.order_now._input_css_commented[i].value;
			}
			
			for( i = 0; i < document.order_now._input_cd_seo.length; i++ )
			{
			if( document.order_now._input_cd_seo[i].checked == true )
			seo_sementic = document.order_now._input_cd_seo[i].value;
			}
			
			for( i = 0; i < document.order_now._input_cd_print_version_css.length; i++ )
			{
			if( document.order_now._input_cd_print_version_css[i].checked == true )
			print_virsion = document.order_now._input_cd_print_version_css[i].value;
			}
			if(pages==1||pages==0||pages=='')
			{
				price = parseInt(typeofweb,10);
			}
			else
			{
					//alert(price);
				price = parseInt(typeofweb,10)*(parseInt(pages,10));
					
				price =parseInt(price)
			}
			
			
			
			value=parseInt(lay_width,10)+parseInt(horizotal_align,10)+parseInt(vartical_align,10)+parseInt(footer_at_bootom,10)+parseInt(em_based,10)+parseInt(opera_camptibality,10)+parseInt(safri_google,10)+parseInt(wysiwg,10)+parseInt(dynamic_rollover,10)+parseInt(dynamic_menu,10)+parseInt(resizeable_fonts,10)+parseInt(sIFR,10)+parseInt(css_options,10)+parseInt(commented,10)+parseInt(coding_option,10)+parseInt(tabless_coding,10)+parseInt(seo_sementic,10)+parseInt(optimize_load,10)+parseInt(implement_ssi,10)+parseInt(print_virsion,10);
		totalprice =parseInt(price,10) + parseInt(value,10);
		document.getElementById('price1').innerHTML  = price;
		document.order_now.price_value.value = price;
}*/
function email_checking()
{	
	var email=document.order_now.email.value;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (!filter.test(email)) 
	{
		alert("Please enter a valid email address!");
		document.order_now.email.focus();
		return false;
	}
}
function final_function()
{
	var value = document.getElementById('price').innerHTML;
	pages	= document.order_now.pages.value;
	
	percent_value = (value*50)/100;
	for(i=1;i<pages;i++){
	value = parseInt(value,10)+percent_value;}
	value =parseInt(value)
	alert(value);
	document.order_now.price_value.value = value;
	document.getElementById('price').innerHTML  = value;
	
	document.order_now.post_back.value = 1;
	document.order_now.price_value.value = value;
	return false;
}
function message()
{
	email =  document.order_now.email.value;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(email=='')
	{
		//alert("Please enter your email address!");
		document.order_now.email.focus();
		document.getElementById('email_error').style.display='';
		return false;
	}
	else
	{
		if (!filter.test(email)) 
		{
			//alert("Please enter a valid email address!");
			document.getElementById('email_error').innerHTML  = 'Please enter a valid email address!';
			document.getElementById('email_error').style.display='';
			document.order_now.email.focus();
			return false;
		}
	}
	return true;
	
}
function submit_form()
{
	email =  document.myform.email.value;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(email!='')
	{
		if (!filter.test(email)) 
		{
			//alert("Please enter a valid email address!");
			document.myform.email.focus();
			document.getElementById('error_mail').style.display='';
			return false;
		}
	}
	
	
	 document.myform.submit();
}
function addRow(tableID) 
{
	var table = document.getElementById(tableID);

	var rowCount = table.rows.length;
	
	var row = table.insertRow(rowCount);
	
	var cell = row.insertCell(0);
	rowCount++;
	var element= document.createElement("input");
	element.type = "file";
	element.name = "brows" + rowCount;
	element.size = "25"; 
	
	cell.appendChild(element);
	document.order_now.Count.value = rowCount;
	
}

function deleteRow(tableID) 
{
	try 
	{
		var table = document.getElementById(tableID);
		var rowCount = table.rows.length;
		if((rowCount-1)==0)
		{
			alert('you can not delete this row');
		}
		else
		{
			
			table.deleteRow(rowCount-1);
			rowCount--;
			document.order_now.Count.value = rowCount;
		}
	}
	catch(e) 
	{
		alert(e);
	}
}
function contact_form()
{
	
	name =  document.contact_mail.Name.value;
	if(name=='')
	{
		//alert('Please enter your name');
		document.getElementById('name').style.display='';
		document.contact_mail.Name.focus();
		return false;
	}
	company =  document.contact_mail.Companyname.value;
	if(company=='')
	{
		//alert('Please enter your company name');compyname
		document.getElementById('compyname').style.display='';
		document.contact_mail.Companyname.focus();
		return false;
	}
	
	
	email =  document.contact_mail.email.value;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(email=='')
	{
		//alert("Please enter your email address!");
		document.getElementById('email_address').style.display='';
		document.contact_mail.email.focus();
		return false;
	}
	else
	{
		if (!filter.test(email)) 
		{
			document.getElementById('email_address').innerHTML  = 'Please enter a valid email address!';
			document.getElementById('email_address').style.display='';
			//alert("Please enter a valid email address!");
			document.contact_mail.email.focus();
			return false;
		}
	}
	phone =  document.contact_mail.Phone.value;
	return true;
}