var MobileTitleName = '';
var MobileCheck = 0;
var phonePrivacy = '';
var OldphonePrivacy = '';
var CurrSubMenuHoverColor = '';
var CurrMenuHoverColor = '';

function changeEmailSafe()
{
	jQuery('#email_safe').html(phonePrivacy);
}
function AWeberSubmit(){
	
	var name	= jQuery.trim(document.formAweber.name.value);
	var email = "";
	if(document.formAweber.from)
	{
		email	= jQuery.trim(document.formAweber.from.value);
	}
	else
	{
		email	= jQuery.trim(document.formAweber.form.value);
	}

	var opttype	= 0;
	if(document.formAweber.opttype)
	{
		opttype = jQuery.trim(document.formAweber.opttype.value);
	}

	if(name.length == 0)
	{
		document.formAweber.name.focus();
		return false;
	}
	if(email.length == 0)
	{
		if(document.formAweber.from)
		{
			document.formAweber.from.focus();
		}
		else
		{
			document.formAweber.form.focus();
		}
		return false;
	}
	
	if(!mailValid(email))
	{
		if(document.formAweber.from)
		{
			document.formAweber.from.focus();
		}
		else
		{
			document.formAweber.form.focus();
		}
		return false;
	}
	if(MobileCheck > 0)
	{
		var Mobile = jQuery.trim(document.formAweber.mobile.value);
		if(Mobile.length == 0)
		{
			document.formAweber.mobile.focus();
			return false;
		}
	}
	if(document.formAweber.email)
	{
		document.formAweber.email.value = email;
	}

	if(MobileTitleName.length > 0)
	{
		if(jQuery('.input_name').length > 0)
		{
			if(jQuery('.input_name').length <= 2)
			{
				var tmp = '<div class="name_font">'+ MobileTitleName+'</div><div class="input_name"><input type="text" name="mobile" class="login_input" id="mobile"></div>';
				 jQuery(tmp).insertBefore('.botton_sign');
				 jQuery('.name_font').eq(0).slideUp("slow");
				 jQuery('.input_name').eq(0).slideUp("slow");				
				 jQuery('#mobile').focus();
				 return false;			
			}
		}
	
		else if(jQuery('.login_input').length > 0)
		{
			if(jQuery('.login_input').length <= 2)
			{
				var tmp = '<tr><td>'+ MobileTitleName+'</td></tr><tr><td><input type="text" name="mobile" class="login_input" id="mobile" /></td></tr>';
				jQuery(tmp).insertBefore(jQuery('.login_input').closest("table").find("tr").eq(5));
				var trLen = jQuery('.login_input').closest("table").find("tr").length;
				for(var i = 0; i < trLen; i++)
				{
					if(i == 1 || i == 2)
					{
						jQuery('.login_input').closest("table").find("tr").eq(i).slideUp("slow");
					}
				}			
				jQuery('#mobile').focus();
				return false;	
			}
		}	 
	}

	if(opttype == 3)
	{
		jQuery('#formAweber').nyroModalManual();
		return true;
	}
	if(opttype == 1)
	{
		document.formAweber.submit();
		return true;
	}
	if (typeof document.body.style.maxHeight === "undefined") {
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{
			if(document.getElementById("TB_overlay") === null){
				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");
		}

		TB_WIDTH = 680; 
		TB_HEIGHT = 480; 
		ajaxContentW = TB_WIDTH - 30;
		ajaxContentH = TB_HEIGHT - 40;

		jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'></div><div id='TB_closeAjaxWindow' style='padding-top: 1px;'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' border='0' align='absmiddle' /></a></div></div><iframe frameborder='0' hspace='0' id='TB_iframeContent' name='TB_iframeContent' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");

		jQuery("#TB_closeWindowButton").click(tb_remove);

		jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
		if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { 
			jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
		}
		jQuery("#TB_window").css({display:"block"});
		

		var __tr_d = getCookie("__tr_d");
		var input = document.createElement("input");
		input.name = "__tr_d";
		input.value = __tr_d;
		input.type = "hidden";
		document.formAweber.appendChild(input);

		document.formAweber.target = "TB_iframeContent";	
		setTimeout('getBTdd()', 3000);
	document.formAweber.submit();
	return true;
	
	
}

function getBTdd()
{
	jQuery("input[name='name']").val('');
	
	if(document.formAweber.from)
	{
		jQuery("input[name='from']").val('');
	}
	else
	{
		jQuery("input[name='form']").val('');
	}
	jQuery("input[name='mobile']").val('');
	
}
function iConactSubmit(){
		
	var name	= jQuery.trim(document.icpsignup.fields_fname.value);
	var email	= jQuery.trim(document.icpsignup.fields_email.value);

	if(name.length == 0)
	{
		ErrorMessageBox(name_require);
		document.icpsignup.fields_fname.focus();
		return false;
	}
	if(email.length == 0)
	{
		document.icpsignup.fields_email.focus();
		return false;
	}
	
	if(!mailValid(email))
	{
		ErrorMessageBox(email_is_invalid);
		document.icpsignup.fields_email.focus();
		return false;
	}

	if (typeof document.body.style.maxHeight === "undefined") {
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{
			if(document.getElementById("TB_overlay") === null){
				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");
		}

		TB_WIDTH = 680; 
		TB_HEIGHT = 480; 
		ajaxContentW = TB_WIDTH - 30;
		ajaxContentH = TB_HEIGHT - 40;

		jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'></div><div id='TB_closeAjaxWindow' style='padding-top: 1px;'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' border='0' align='absmiddle' /></a></div></div><iframe frameborder='0' hspace='0' id='TB_iframeContent' name='TB_iframeContent' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");

		jQuery("#TB_closeWindowButton").click(tb_remove);

		jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
		if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { 
			jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
		}
		jQuery("#TB_window").css({display:"block"});
		document.icpsignup.target = "TB_iframeContent";

	return true;
}

function animateBar(){
	jQuery(".precent").each(function(){
		var pre;
		jQuery(this).css("width","0px");
		if (jQuery(this).attr("precent"))
		{
			pre = jQuery(this).attr("precent");
		}
		else
		{
			pre = 0;
		}
		jQuery(this).animate({width: pre},"slow");
	});
}

function pollSubmit(id, iCount)
{
	var itemID = '', itemIDlist = '';
	var pollID, type, freeAnswer = '';		
	var vselect = -1;
	var itemIDBox = '';
	for(var j = 0; j < iCount; j++)
	{
		pollID = document.getElementById('id_' + id + '_' + (j+1)).value;
		type =  document.getElementById('type_' + id + '_' + (j+1)).value;
		if(type == 1)
		{
			var paynames = document.getElementsByName("iddetail_" + pollID);
			for(var i=0;i<paynames.length;i++)
			{
				if(paynames[i].checked)
				{
					vselect = 1;
					itemID = paynames[i].value;
					itemIDlist += itemID + '|';
				}
			}
			if(vselect != 1)
			{
				jQuery('#pollresult').html('<font color=red>Please Select poll radio/check</font><br>');
				setTimeout(function xx(){jQuery('#pollresult').fadeOut("slow");}, 8000);
				return false;
			}
		}
		else if(type == 2)
		{
			var paynames = document.getElementsByName("iddetail_" + pollID + '[]');
			for(var i=0;i<paynames.length;i++)
			{
				if(paynames[i].checked)
				{
					vselect = 1;
					itemIDBox += paynames[i].value + ',';
				}
			}
			
			if(vselect != 1)
			{
				jQuery('#pollresult').html('<font color=red>Please Select poll radio/check</font><br>');
				setTimeout(function xx(){jQuery('#pollresult').fadeOut("slow");}, 8000);
				return false;
			}
			else
			{
				itemIDBox = itemIDBox.substring(0, itemIDBox.length - 1);							
				itemIDlist += itemIDBox + '|';
				itemIDBox = '';
			}
		}
		else if(type == 3)
		{
			var x = document.getElementById("iddetail_" + pollID).value;
			if(x == '')
			{
				jQuery('#pollresult').html('<font color=red>Please enter content</font><br>');
				setTimeout(function xx(){jQuery('#pollresult').fadeOut("slow");}, 8000);
				return false;
			}
			else
			{
				freeAnswer += pollID + '=' + x + '|';
			}
		}
		vselect = -1;
	}
	if(freeAnswer)
	{
		freeAnswer = freeAnswer.substring(0, freeAnswer.length -1);
	}
	itemIDlist = itemIDlist.substring(0, itemIDlist.length - 1);	
	jQuery.ajax({
			url: "/poll.php",
			type: "POST",
			data: {todo: "addpoll", pid: id, iddetail: itemIDlist, freeanswer:freeAnswer},
			dataType: "text",
			error: function()
			{
				alert("error!");
			},
			success: function(data)
			{	
				jQuery('#poll_' + id).html(data);
				try{	
				jQuery(document).ready(function(){
				animateBar();
				});
				}catch(e){}
			}
		});
				
}


function ErrorMessageBox(msg)
{
	msg = msg.replace("&#039;", "\\&#039;");
	
	if (typeof document.body.style.maxHeight === "undefined") {
		jQuery("body","html").css({height: "100%", width: "100%"});
		jQuery("html").css("overflow","hidden");
		if (document.getElementById("TB_HideSelect") === null) {
			jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
			jQuery("#TB_overlay").click(tb_remove);
		}
	}else{
		if(document.getElementById("TB_overlay") === null){
			jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
			jQuery("#TB_overlay").click(tb_remove);
		}
	}
	
	if(tb_detectMacXFF()){
		jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
	}else{
		jQuery("#TB_overlay").addClass("TB_overlayBG");
	}

	TB_WIDTH = 320; 
	TB_HEIGHT = 150; 
	ajaxContentW = TB_WIDTH - 30;
	ajaxContentH = TB_HEIGHT - 40;

	var frameId = 'iFrame'+new Date().getTime();
	jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'></div><div id='TB_closeAjaxWindow' style='padding-top: 1px;'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' border='0' align='absmiddle' /></a></div></div><iframe frameborder='0' hspace='0' class='TB_iframeContent' name='" + frameId + "' id='" + frameId + "' onload=\"OnMessageIFrameLoad('" + frameId + "', '" + msg + "')\" style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' src='/oops2.html'> </iframe>");

	jQuery("#TB_closeWindowButton").click(tb_remove);

	jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { 
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
	jQuery("#TB_window").css({display:"block"});

	return true;
}

function ShowModelMessageBox(msg)
{
	if (typeof document.body.style.maxHeight === "undefined") {
		jQuery("body","html").css({height: "100%", width: "100%"});
		jQuery("html").css("overflow","hidden");
		if (document.getElementById("TB_HideSelect") === null) {
			jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}else{
		if(document.getElementById("TB_overlay") === null){
			jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}
	
	if(tb_detectMacXFF()){
		jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
	}else{
		jQuery("#TB_overlay").addClass("TB_overlayBG");
	}

	TB_WIDTH = 420; 
	TB_HEIGHT = 150; 
	ajaxContentW = TB_WIDTH - 30;
	ajaxContentH = TB_HEIGHT - 40;

	var frameId = 'iFrame'+new Date().getTime();
	jQuery("#TB_window").append("<div id='TB_title' style='display: none;'><div id='TB_ajaxWindowTitle'></div><div id='TB_closeAjaxWindow' style='padding-top: 1px;'><a href='#' id='TB_closeWindowButton' title='Close'><!-- img src='" + tb_closeImage + "' border='0' align='absmiddle' / --></a></div></div><iframe frameborder='0' hspace='0' class='TB_iframeContent' name='" + frameId + "' id='" + frameId + "' onload=\"OnMessageIFrameLoad('" + frameId + "', '" + msg + "')\" style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' src='/oops2.html'> </iframe>");

	jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) {
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
	jQuery("#TB_window").css({display:"block"});

	return true;
}

function OnMessageIFrameLoad(frameId, msg)
{
	tb_showIframe();

	var doc;
	if (document.all){
			doc = document.frames[frameId].document;
	}else{ 
			doc = document.getElementById(frameId).contentDocument;
	}
	var m = doc.getElementById("message");
	if(m)
	{
		m.innerHTML = msg;
	}
}

function mailValid(str)
{
	var supported = 0;
	if (window.RegExp)
	{
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) 
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,8}|[0-9]{1,7})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

function update_page (result) 
{	 
	if(result == 'error')
	{
		ErrorMessageBox(Verification_word_error);
	}
	else
	{
		document.form1.full_name.value = '';
		document.form1.email.value = '';
		document.form1.subject.value = '';
		document.form1.body.value = '';
		document.form1.verify.value = '';
		jQuery('#returnlabel').html(result).show();
	}
}

function checkLevel()
{
	var name	= jQuery.trim(document.form1.user.value);
	var city	= jQuery.trim(document.form1.city.value);
	var content	= jQuery.trim(document.form1.content.value);
	var code	= jQuery.trim(document.form1.verify.value);

	if(content.length == 0)
	{
		ErrorMessageBox('Testimonial message is required');
		document.form1.content.focus();
		return false;
	}
	if(name.length == 0)
	{		
		ErrorMessageBox("Client's name is required");
		document.form1.user.focus();
		return false;
	}
	
	if(city.length == 0)
	{
		ErrorMessageBox("Client's location is required");
		document.form1.city.focus();
		return false;
	}
	if(code.length == 0)
	{
		ErrorMessageBox("Verification word is required");
		document.form1.verify.focus();
		return false;
	}
	
	var msg = $.ajax({
	    type: "POST", 
		url:"include/checkRandcode.php",
		data: "randcode=" + code,
	    async: false   
	}).responseText; 
	    
	if(msg == 1) {
		ErrorMessageBox("You did not enter the correct verification code. Please try again.");
		jQuery("#imgRandcode").attr("src",jQuery("#imgRandcode").attr("src")+"?t="+Math.random());
		document.form1.verify.focus();

	    return false;	
	}
}

function hideFormNamediv()
{
	jQuery('#formnamedivid').fadeOut("slow");	
}
function hideFormEmaildiv()
{
	jQuery('#formemaildivid').fadeOut("slow");
}


jQuery(document).ready(function ()
{				
	
	jQuery("input[name='name']").click(function(){jQuery('#email_safe').html(OldphonePrivacy);});
	jQuery("input[name='from']").click(function(){jQuery('#email_safe').html(OldphonePrivacy);});
	jQuery("input[name='form']").click(function(){jQuery('#email_safe').html(OldphonePrivacy);});
	jQuery("input[name='name']").blur(function(){
		if(jQuery("input[name='name']").val().length > 0)
		{			
			jQuery('#formnamedivid').show();
			jQuery('#formnamedivtitle').css('padding-top','10px').css('text-align','center').css('color','#000000').html('Nice to meet you ' + jQuery("input[name$='name']").val()).show();
			setTimeout('hideFormNamediv()', 3000);			
		}
	});

	jQuery("input[name='from']").blur(function(){
		if(jQuery("input[name='from']").val().length > 0 && mailValid(jQuery("input[name='from']").val()))
		{				
			jQuery('#formemaildivid').show();
			jQuery('#formemaildivtitle').css('padding-top','10px').css('text-align','center').css('color','#000000').html('Ok, thanks.').show();
			
			setTimeout('hideFormEmaildiv()', 3000);
		}
	});
	

	jQuery('#send_ajax').css("cursor","pointer");
	jQuery('#send_ajax').click(function ()
    {
		var name	= jQuery.trim(document.form1.full_name.value);
		var email	= jQuery.trim(document.form1.email.value);
		var subject = jQuery.trim(document.form1.subject.value);
		var body	= jQuery.trim(document.form1.body.value);
		var code	= jQuery.trim(document.form1.verify.value);

		if(name.length == 0)
		{		
			ErrorMessageBox(Full_Name_is_required);
			document.form1.full_name.focus();
			return false;
		}
		if(email.length == 0)
		{
			ErrorMessageBox(email_require);
			document.form1.email.focus();
			return false;
		}
		
		if(!mailValid(email))
		{
			ErrorMessageBox(email_is_invalid);
			document.form1.email.focus();
			return false;
		}

		if(subject.length == 0)
		{
			ErrorMessageBox(Subject_is_required);
			document.form1.subject.focus();
			return false;
		}
		if(body.length == 0)
		{
			ErrorMessageBox(Contents_is_required);
			document.form1.body.focus();
			return false;
		}
		if(code.length == 0)
		{
			ErrorMessageBox(Verification_word_is_required);
			document.form1.verify.focus();
			return false;
		}
		
		jQuery.ajax(
		{
			url:'contact.php',
			type:'post', 
			data:{name:name, email:email, subject:subject, body:body, verify:code, submit:'submit'},
			success:update_page,
			error: function(){
			   alert("error");
			}
		});
    });

	var show_item = "sub_1", top_submenu = "subTop_1"; 
	
	if (getCookie("show_item") != null) 
	{		
		show_item= "sub_" + getCookie("show_item"); 
		top_submenu= "subTop_" + getCookie("show_item"); 
		sub_item_close="sub_" +getCookie("sub_item_close"); 
		
		//if(!sub_color) sub_color = CurrSubMenuHoverColor;
		//alert(sub_color);
		jQuery("#parentmenu_" + getCookie("show_item")).css('color', CurrMenuHoverColor);
		var sub_item = getCookie("sub_item");
		if(sub_item)
		{
			jQuery("#sub_" + sub_item).css("color", CurrSubMenuHoverColor);
		}	
		setCookie("show_item", getCookie("show_item"), -10000);
	} 
	if(document.getElementById(show_item))
	{
		
		if(sub_item_close!=show_item) {
		document.getElementById(show_item).style.display = "block"; 
		}
		if(document.getElementById(top_submenu))
		{
			document.getElementById(top_submenu).style.display = "block"; 
		}
		
	}
	
	jQuery("#lrc_language_newallbox").hover(
			function () {
					jQuery("#lrc_language_newbox").show();
					jQuery("#lrc_language_newbtn2").show();
					jQuery("#lrc_language_newbtn").hide();
			},
			function(){
					jQuery("#lrc_language_newbox").hide();
					jQuery("#lrc_language_newbtn2").hide();
					jQuery("#lrc_language_newbtn").show();
			}
	);
	jQuery("#lrc_language_newbox").hover(
			function () {
					jQuery("#lrc_language_newbox").show();
					jQuery("#lrc_language_newbtn2").show();
					jQuery("#lrc_language_newbtn").hide();
			},
			function(){
					jQuery("#lrc_language_newbox").hide();
					jQuery("#lrc_language_newbtn2").hide();
					jQuery("#lrc_language_newbtn").show();
			}
	);
	jQuery("#lrc_search_newbox").hover(
			function () {
					jQuery("#lrc_search_downbg").show();
					jQuery("#lrc_newserchshow").show();
					jQuery("#lrc_newserchhide").hide();
			},
			function(){
					jQuery("#lrc_search_downbg").hide();
					jQuery("#lrc_newserchshow").hide();
					jQuery("#lrc_newserchhide").show();
			}
	);
	jQuery("#lrc_search_downbg").hover(
			function () {
					jQuery("#lrc_search_downbg").show();
					jQuery("#lrc_newserchshow").show();
					jQuery("#lrc_newserchhide").hide();
			},
			function(){
					jQuery("#lrc_search_downbg").hide();
					jQuery("#lrc_newserchshow").hide();
					jQuery("#lrc_newserchhide").show();
			}
	);						
	

	var topW = jQuery('#top_right_content_body').width();
	var topH = jQuery('#top_right_content_body').height();
	//alert(topW + ':' + topH);
	jQuery('#top_right_content_background').css({'width':topW +'px', 'height': topH + 'px'});
	

	jQuery.ajax({
		url: "/report_spam.php",
		type: "post",
		data: {todo: "getsolical"},
		dataType: "json",
		error: function()
		{
			//alert("error!");
		},
		success: function(data)
		{		
			var str = "";
			if(data.length > 0)
			{
				//if($('#menufoot').height() > 50)
				{
					$('#menufoot').css('height','auto');
					//$('#menufoot').css('font-weight','normal');
				}
				str += "<div style='text-align:center;padding-top:10px'>";
				for(var i = 0; i < data.length; i++)
				{
					var name = data[i].name;
					var url = data[i].url;
					if(name == 'facebook')
					{
						str += "<a href='"+ url +"' target='_blank'><img src='/images/facebook-elegant.png' alt='' border='0'></a> ";
					}
					if(name == 'googleplus')
					{
						str += "<a href='"+ url +"' target='_blank'><img src='/images/googleplus-icon.png' alt='' border='0'></a> ";
					}
					if(name == 'twitter')
					{
						str += "<a href='"+ url +"' target='_blank'><img src='/images/twitter-elegant.png' alt='' border='0'></a> ";
					}
					if(name == 'linkedin')
					{
						str += "<a href='"+ url +"' target='_blank'><img src='/images/linkedin-elegant.png' alt='' border='0'></a> ";
					}
					if(name == 'youtube')
					{
						str += "<a href='"+ url +"' target='_blank'><img src='/images/youtube-elegant.png' alt='' border='0'></a> ";
					}
				}
				
				str += "</div>";
				
				jQuery("#fdlayer").last().append(str);
			}				
		}
	});
});

function searchlangmouseOver()
{
document.getElementById("lrc_newserchhide").src ="/images/search_newbtn2.png";
}
function searchlangmouseOut()
{
document.getElementById("lrc_newserchhide").src ="/images/search_newbtn.png";
}
	
var _sub_menu_slide_downing = false;
function showSubMenu(sid)
{
	
	setCookie('menu_color', jQuery("#parentmenu_" + sid).css("color"));
	
	var obj = document.getElementById("sub_" + sid);
	
	if(!obj)
	{
		if(document.getElementById('subTop_' + sid))
		{   		    	
			jQuery("#subTop_" + sid).slideDown("slow", function(){_sub_menu_slide_downing = false;}); 
		}
		return;
	}
	
	if(obj.style.display=="block") {
		
		jQuery(".sub_css").css("display", "none");
		
		setCookie('sub_item_close', sid);
		
		return;
		
	}
	
	setCookie("sub_item_close", "", -10000);
	
	jQuery(".sub_css").css("display", "none");	
	

	var x = obj.style.display;	
	
	if(x == "block")
	{
		
		if(document.getElementById('subTop_' + sid))
		{
			jQuery("#subTop_" + sid).fadeIn().hide("slow");
		}
        
		jQuery("#sub_" + sid).fadeIn().hide("slow");
	}
	else
	{
		_sub_menu_slide_downing = true;
		if(document.getElementById('subTop_' + sid))
		{   
		    
			
			jQuery("#subTop_" + sid).slideDown("slow", function(){_sub_menu_slide_downing = false;}); 
			
		
			
		}
		jQuery("#sub_" + sid).slideDown("slow", function(){_sub_menu_slide_downing = false;}); 
		
		var children=jQuery("#sub_" + sid+" a").length;
		jQuery("#left").css("height");
		
	}
	
}
function clickTopSubMenu(sid, ind)
{
	setCookie('sub_menu_color', CurrSubMenuHoverColor);
	setCookie('sub_item', sid + '_menu_' + ind);
}

function clickSubMenu(sid, ind)
{
	setCookie('sub_menu_color', CurrSubMenuHoverColor);
	setCookie('sub_item', sid + '_menu_' + ind);
}


function HideAll() { 
    var items = document.getElementsByName("pro_title"); 
    for (var j=0; j<items.length; j++) {
		document.getElementById("sub_" + (j+1)).style.display = "none"; 
    } 
} 
function setCookie(sName,sValue,expireHours) { 
  
   var cookieString = sName + " = " + escape(sValue);
   if (expireHours != undefined) { 
        var date = new Date(); 
         date.setTime(date.getTime() + expireHours * 3600 * 1000); 
         cookieString = cookieString + "; expire = " + date.toGMTString(); 
   }
   cookieString = cookieString + "; path=/;";
   document.cookie = cookieString; 
} 
function getCookie(sName) { 
  var aCookie = document.cookie.split("; "); 
  for (var j=0; j < aCookie.length; j++){ 
    var aCrumb = aCookie[j].split("="); 
    if (escape(sName) == aCrumb[0]) 
      return unescape(aCrumb[1]); 
  } 
 return null; 
} 


function viewTwitterMessage()
{
	jQuery('#twit').show("slow");
}

function hideMsgBox(e,o)
{	
	if(window.navigator.userAgent.indexOf("Firefox")>=1) 
	{ 
		if(document.getElementById('twit').compareDocumentPosition(e.relatedTarget ) > 0) 
		{
			setTimeout('timeouthide()', 2000);
		}
	}
	else
	{
		if(o.contains(e.toElement ) == false) 
		{
			setTimeout('timeouthide()', 2000);
		}
	}	
}

function timeouthide()
{
	jQuery('#twit').hide("slow");
}

function reportSpamSubmit(){
	var FirstName	= jQuery.trim(document.spamform.FirstName.value);
	var LastName	= jQuery.trim(document.spamform.LastName.value);
	var emailaddress	= jQuery.trim(document.spamform.emailaddress.value);
	var domain	= jQuery.trim(document.spamform.domain.value);
	var emailBody = jQuery.trim(document.spamform.emailbody.value);
	var verify = jQuery.trim(document.spamform.verify.value);
	if(FirstName.length == 0)
	{
		jQuery("#layerSpamMsg").html(name_require).show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.FirstName.focus();
		return false;
	}
	if(LastName.length == 0)
	{
		jQuery("#layerSpamMsg").html(name_require).show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.LastName.focus();
		return false;
	}
	if(emailaddress.length == 0)
	{
		jQuery("#layerSpamMsg").html(email_require).show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.emailaddress.focus();
		return false;
	}
	
	if(!mailValid(emailaddress))
	{
		jQuery("#layerSpamMsg").html(email_is_invalid).show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.emailaddress.focus();
		return false;
	}

	if(document.spamform.emailaddress)
	{
		document.spamform.emailaddress.value = emailaddress;
	}
	if(domain.length == 0)
	{
		jQuery("#layerSpamMsg").html('Oops... Be sure to enter domain before you can continue!').show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.domain.focus();
		return false;
	}
	var done = 0;
	var abuseValue = "";
	var nobj = document.getElementsByName("abuseradio");
	for(var i = 0 ; i < nobj.length; i++)
	{
		if(nobj[i].checked == true)
		{
			done = 1;
			abuseValue = nobj[i].value;
		}
	}
	if(emailBody.length == 0 && done == 0)
	{			
		jQuery("#layerSpamMsg").html('Paste the entire e-mail that prompted your complaint into the provided box.').show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		return false;
	}
	if(verify.length == 0)
	{
		jQuery("#layerSpamMsg").html('Please enter the verification code.').show();
		setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
		document.spamform.verify.focus();
		return false;
	}

	jQuery.ajax({
			url: "/report_spam.php",
			type: "POST",
			data: {todo: "send", FirstName:FirstName, LastName:LastName,emailaddress:emailaddress,domain:domain,emailbody:emailBody,verify:verify,abuseradio:abuseValue},
			dataType: "text",
			error: function()
			{
				alert("error!");
			},
			success: function(data)
			{					
				
				if(data.length > 0)
				{
					if(data == 'error')
					{
						jQuery("#layerSpamMsg").html('verification code error.').show();
						setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
						document.spamform.verify.focus();
						return false;
					}
					else if(data == 'error1')
					{
						jQuery("#layerSpamMsg").html('Paste the entire e-mail that prompted your complaint into the provided box.').show();
						setTimeout(function xx(){jQuery("#layerSpamMsg").fadeOut("slow");}, 8000);
						return false;
					}
				}
				else
				{
					jQuery('#layerSpamMsg').css('display','none');
					jQuery('.report_notebar').css('display','none');
					jQuery('.report_input_tab').css('display','none');
					jQuery('.report_midfont').css('display','none');
					jQuery('.report_textarea').css('display','none');
					jQuery('.report_yzm').css('display','none');
					jQuery('.report_but').css('display','none');
					jQuery('#reportSpamResultMsg').css('display','');
				}
			}
		});
	return false;
}

function getReportPage()
{
	jQuery("#sapma").css('display','');
	jQuery("#sapmb").css('display','none');
	jQuery("#reportspamtitle").css('display', '');
	jQuery("#reportmid").css('display', '');
	jQuery("#reporttext").css('display', '');

	
	jQuery("#abusetitle").css('display', 'none');
	jQuery("#abusemid").css('display', 'none');
	jQuery("#abusetext").css('display', 'none');

	jQuery(".report_input_tab").css('display', '');
	jQuery(".report_yzm").css('display', '');
	jQuery(".report_but").css('display', '');
	jQuery(".report_notebar").css('display', '');
	var h = jQuery(".report_input_tab").height() + jQuery(".report_yzm").height() + jQuery(".report_but").height() + jQuery(".report_notebar").height() + jQuery("#sapma").height() + jQuery("#reportspamtitle").height() + jQuery("#reportmid").height()+jQuery("#reporttext").height() + 170;
	var lefth = jQuery('#left').height();
	if(lefth < h)
	{
		jQuery('#left').css('height', h + 'px');
	}

}

function getAbusePage()
{
	jQuery("#sapma").css('display','none');
	jQuery("#sapmb").css('display','');

	jQuery("#abusetitle").css('display', '');
	jQuery("#abusemid").css('display', '');
	jQuery("#abusetext").css('display', '');	

	
	jQuery("#reportspamtitle").css('display', 'none');
	jQuery("#reportmid").css('display', 'none');
	jQuery("#reporttext").css('display', 'none');

	jQuery(".report_input_tab").css('display', '');
	jQuery(".report_yzm").css('display', '');
	jQuery(".report_but").css('display', '');
	jQuery(".report_notebar").css('display', '');
     
	var h = jQuery(".report_input_tab").height() + jQuery(".report_yzm").height() + jQuery(".report_but").height() + jQuery(".report_notebar").height() + jQuery("#sapmb").height() + jQuery("#abusetitle").height() + jQuery("#abusemid").height()+jQuery("#abusetext").height() + 170;
	var lefth = jQuery('#left').height();
	if(lefth < h)
	{
		jQuery('#left').css('height', h + 'px');
	}
}

function formAuthorizesubmit()
{
	var x_ship_to_first_name = jQuery.trim(document.form1.x_ship_to_first_nxame.value);
	if(x_ship_to_first_name.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_ship_to_first_nxame.focus();
		document.form1.x_ship_to_first_nxame.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_ship_to_first_nxame.style.border = "1px solid #039";
	}

	var x_ship_to_last_name = jQuery.trim(document.form1.x_ship_to_last_nxame.value);
	if(x_ship_to_last_name.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_ship_to_last_nxame.focus();
		document.form1.x_ship_to_last_nxame.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_ship_to_last_nxame.style.border = "1px solid #039";
	}

	var x_ship_to_address = jQuery.trim(document.form1.x_ship_to_address.value);
	if(x_ship_to_address.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_ship_to_address.focus();
		document.form1.x_ship_to_address.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_ship_to_address.style.border = "1px solid #039";
	}

	var x_ship_to_city = jQuery.trim(document.form1.x_ship_to_city.value);
	if(x_ship_to_city.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_ship_to_city.focus();
		document.form1.x_ship_to_city.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_ship_to_city.style.border = "1px solid #039";
	}

	var x_ship_to_state = jQuery.trim(document.form1.x_ship_to_state.value);
	var obj_state = document.form1.x_ship_to_state;
	if(document.form1.x_ship_to_country.selectedIndex == 0)
	{
		obj_state = document.form1.us_state;
	}

	if(x_ship_to_state.length == 0)
	{
		jQuery("#errdiv").show();
		obj_state.focus();
		obj_state.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		obj_state.style.border = "1px solid #039";
	}

	var x_ship_to_zip = jQuery.trim(document.form1.x_ship_to_zip.value);
	if(x_ship_to_zip.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_ship_to_zip.focus();
		document.form1.x_ship_to_zip.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_ship_to_zip.style.border = "1px solid #039";
	}


	var x_email = jQuery.trim(document.form1.x_email.value);
	if(x_email.length == 0)
	{
		jQuery("#errdiv").show();
		document.form1.x_email.focus();
		document.form1.x_email.style.border = "2px solid #f90";
		return false;
	}
	else
	{
		document.form1.x_email.style.border = "1px solid #039";
	}

	
	return true;
}

function CalShipRate(ShipFromID)
{
	var Name = document.form1.x_ship_to_first_nxame.value + " " + document.form1.x_ship_to_last_nxame.value;
	var Address = document.form1.x_ship_to_address.value;
	var City = document.form1.x_ship_to_city.value;
	var State = document.form1.x_ship_to_state.value;
	var Country = document.form1.x_ship_to_country.value;
	var Company = document.form1.x_email.value;
	var Zip = document.form1.x_ship_to_zip.value;
	var Phone = document.form1.x_phone.value;
	var weight = document.form1.weight.value;

	if(!Name && !Address && !City && !State && !Country && !Zip)
	{
		return false;
	}
	var shipMethods = document.getElementsByName('selectship');
	var ship = '';
	for(var i = 0; i < shipMethods.length; i++)
	{
		if(shipMethods[i].checked)
		{
			ship = shipMethods[i].value;
		}
	}
	if(!ship)
	{
		return false;
	}
	if(ship == 'fedex')
	{
		var serviceType = document.form1.fedexservicetype.value;
		var packkageType = document.form1.fedexpackagetype.value;
		
		jQuery.ajax({ 
			url: "shopcart_ajax.php",
			type: "POST",
			dataType: "text",
			data: {todo:'calshiprate', shiptype:ship, id: ShipFromID, name:Name, company:Company, address:Address, city:City, state:State, zip:Zip, phone:Phone, country:Country, weight:weight, service:serviceType, packages:packkageType},
			success: function(data){alert(data);
				if(data.indexOf('ERROR') > -1)
				{
					jQuery('#shipdiv').html('Select a ship service:<b><font color=red>('+ data +')</b></font>');
				}
				else
				{
					var num = document.form1.quantity.value;
					var saleprice = parseFloat(document.form1.salehp.value);
					var weight = parseFloat(document.form1.weight.value);
					var subtotal = saleprice * num + parseFloat(data), weights = weight * num;
					jQuery('#total').val('$' + subtotal.toFixed(2));
					jQuery('#weight').val(weights.toFixed(2));
					jQuery('#shipcost').val(parseFloat(data));
					jQuery('#paymentbutton').show();
				}
				
			},
			error: function(){
			}
		});
	}
	else if(ship == 'ups')
	{
		var serviceType = document.form1.upsservicetype.value;
		var packkageType = document.form1.upspackagetype.value;
		
		jQuery.ajax({ 
			url: "shopcart_ajax.php",
			type: "POST",
			dataType: "text",
			data: {todo:'calshiprate', shiptype:ship, id: ShipFromID, name:Name, company:Company, address:Address, city:City, state:State, zip:Zip, phone:Phone, country:Country, weight:weight, service:serviceType, packages:packkageType},
			success: function(data){alert(data);
				if(data.indexOf('Error') > -1)
				{
					jQuery('#shipdiv').html('Select a ship service:<b><font color=red>('+ data +')</b></font>');
				}				
				else
				{
					var num = document.form1.quantity.value;
					var saleprice = parseFloat(document.form1.salehp.value);
					var weight = parseFloat(document.form1.weight.value);
					var subtotal = saleprice * num + parseFloat(data), weights = weight * num;
					jQuery('#total').val('$' + subtotal.toFixed(2));
					jQuery('#weight').val(weights.toFixed(2));
					jQuery('#shipcost').val(parseFloat(data));
					jQuery('#paymentbutton').show();
				}
				
			},
			error: function(){
			}
		});
	}
	else if(ship == 'usps')
	{
	}
}

function closeNyroModal(param)
{			
	jQuery.nyroModalRemove();
	if(param)
	{
		location.href = document.URL;
	}
}

function SendMobileCustomerForm(FormID)
{
	//alert(FormID);
	var ReqTexts = jQuery('#reqtext_' + FormID).val();
	var ReqTextArr = ReqTexts.split('|');
	for(var i = 0; i < ReqTextArr.length; i++)
	{
		var arr = ReqTextArr[i].split(":");
		var Type = arr[0];
		var vname = arr[1];
		var vid = arr[2];
		var result = 0;

		if(Type == 'text')
		{
			if(jQuery('#' + vid).val() == '')
			{
				jQuery('#tip_' + vid).html('*<i>(Required)</i>');
				jQuery('#' + vid).focus();
				$("#beforesend_" + FormID).html('');
				$("#formtip_" + FormID).show();
				return false;
			}
		}
		else if(Type == 'radio' || Type == 'checkbox')
		{
			var obj = document.getElementsByName(vid);
			for(var n = 0; n < obj.length; n++)
			{
				if(obj[n].checked == true)
				{
					result = 1;
					break;
				}
			}
			if(result == 0)
			{
				if(Type == 'checkbox')
				{

					var p = vid.substring(0, vid.length-2);
					jQuery('#tip_' + p).html('*<i>(Required)</i>');
				}
				else
				{
					jQuery('#tip_' + vid).html('*<i>(Required)</i>');
				}
				$("#beforesend_" + FormID).html('');
				$("#formtip_" + FormID).show();
				return false;
			}
		}
		else if(Type == 'grid')
		{

			var obj = document.getElementsByName(vid);
			for(var n = 0; n < obj.length; n++)
			{
				if(obj[n].checked == true)
				{
					result = 1;
					break;
				}
			}

			if(result == 0)
			{
				var parr = vid.split('_');
				var pid = '';
				for(var j = 0; j < parr.length -1; j++)
				{
					pid +=  parr[j] + '_';
				}
				pid = pid.substring(0, pid.length-1);

				jQuery('#tip_' + pid).html('*<i>(Required)</i>');
				$("#beforesend_" + FormID).html('');
				$("#formtip_" + FormID).show();
				return false;
			}
		}

	}
	return true;
}

function SendCustomerForm(FormID)
{
	$("#beforesend_" + FormID).html('<img src="/images/ajax-loader.gif">');
	jQuery("#customer_" + FormID).ajaxSubmit({

		dataType: "text",
		beforeSubmit: validate,
		error: function(d)
		{
			//alert("error " + d);
		},
		success: function(data){
			$("#beforesend_" + FormID).html('');
			var sd = data.split('|');
			if(sd[1] == 0)
			{
				location.href = sd[0];
			}
			else
			{
				$('#customerformdiv_' + FormID).html(sd[0]);
				$('.page_break_title_' + FormID).show();
				location.href = '#a_buildform_' + FormID;
			}
		}
	});

}



function validate(formData, jqForm, options)
{
	var id = jqForm[0].id;
	var FormID = id.split('_')[1];
	var ReqTexts = jQuery('#reqtext_' + FormID).val();
	var ReqTextArr = ReqTexts.split('|');
    var reqcaptcha=jQuery('#reqcaptcha_' + FormID).val();
	for(var i = 0; i < ReqTextArr.length; i++)
	{
		var arr = ReqTextArr[i].split(":");
		var Type = arr[0];
		var vname = arr[1];
		var vid = arr[2];
		var result = 0;

		if(Type == 'text')
		{
			if(jQuery('#' + vid).val() == '')
			{
				jQuery('#tip_' + vid).html('*<i>(Required)</i>');
				jQuery('#' + vid).focus();
				$("#beforesend_" + FormID).html('');
				return false;
			}
		}
		else if(Type == 'email')
		{
			if(jQuery('#' + vid).val() == '')
			{
				jQuery('#tip_' + vid).html('*<i>(Required)</i>');
				jQuery('#' + vid).focus();
				$("#beforesend_" + FormID).html('');
				return false;
			}
			else
			{
				if(!mailValid(jQuery('#' + vid).val()))
				{
					jQuery('#tip_' + vid).html('*<i>(Error Email Address)</i>');
					jQuery('#' + vid).focus();
					$("#beforesend_" + FormID).html('');
					return false;
				}
			}
		}
		else if(Type == 'radio' || Type == 'checkbox')
		{
			var obj = document.getElementsByName(vid);
			for(var n = 0; n < obj.length; n++)
			{
				if(obj[n].checked == true)
				{
					result = 1;
					break;
				}
			}
			if(result == 0)
			{
				if(Type == 'checkbox')
				{

					var p = vid.substring(0, vid.length-2);
					jQuery('#tip_' + p).html('*<i>(Required)</i>');
				}
				else
				{
					jQuery('#tip_' + vid).html('*<i>(Required)</i>');
				}
				$("#beforesend_" + FormID).html('');
				return false;
			}
		}
		else if(Type == 'grid')
		{

			var obj = document.getElementsByName(vid);
			for(var n = 0; n < obj.length; n++)
			{
				if(obj[n].checked == true)
				{
					result = 1;
					break;
				}
			}

			if(result == 0)
			{
				var parr = vid.split('_');
				var pid = '';
				for(var j = 0; j < parr.length -1; j++)
				{
					pid +=  parr[j] + '_';
				}
				pid = pid.substring(0, pid.length-1);

				jQuery('#tip_' + pid).html('*<i>(Required)</i>');
				$("#beforesend_" + FormID).html('');
				return false;
			}
		}

	}
	if(jQuery.trim(reqcaptcha)!="") {
		var captchaValue=jQuery("#captcha_"+FormID).val();
		if(jQuery.trim(captchaValue)=='') {
			jQuery('#captcha_required_'+FormID).html('*<i>(Required)</i>');	
			jQuery("#captcha_"+FormID).focus();
			$("#beforesend_" + FormID).html('');
			return false;
		}
		else {
			var CheckRs = jQuery.ajax({
			type: "POST",
			url: "/include/CheckCaptcha.php",
			data: "captchaValue="+captchaValue+"&fid="+FormID,
			async: false   
			}).responseText;
			if(CheckRs.indexOf("Error")!=-1) {
				  jQuery('#captcha_required_'+FormID).html("*<i>(The words you typed don't match. Please try again.)</i>");	
				  jQuery("#captcha_"+FormID).focus();
				  $("#beforesend_" + FormID).html('');
				  return false;
		   }
		   
		}  //end of else 
	}

	return true;
}



function validateStep(FormID, step, PageCount)
{
	var ReqTexts = jQuery('#reqtext_' + FormID).val();
	var ReqTextArr = ReqTexts.split('|');
	for(var i = 0; i < ReqTextArr.length; i++)
	{
		var arr = ReqTextArr[i].split(":");
		var Type = arr[0];
		var vname = arr[1];
		var vid = arr[2];
		var result = 0;

		if(parseInt(vname) == step)
		{
			if(Type == 'text')
			{
				if(jQuery('#' + vid).val() == '')
				{
					jQuery('#tip_' + vid).html('*<i>(Required)</i>');
					jQuery('#' + vid).focus();
					$("#beforesend_" + FormID).html('');
					return false;
				}
			}
			
			else if(Type == 'email')
			{
				if(jQuery('#' + vid).val() == '')
				{
					jQuery('#tip_' + vid).html('*<i>(Required)</i>');
					jQuery('#' + vid).focus();
					$("#beforesend_" + FormID).html('');
					return false;
				}
				else
				{
					if(!mailValid(jQuery('#' + vid).val()))
					{
						jQuery('#tip_' + vid).html('*<i>(Error Email Address)</i>');
						jQuery('#' + vid).focus();
						$("#beforesend_" + FormID).html('');
						return false;
					}
				}
			}
			else if(Type == 'radio' || Type == 'checkbox')
			{
				var obj = document.getElementsByName(vid);
				for(var n = 0; n < obj.length; n++)
				{
					if(obj[n].checked == true)
					{
						result = 1;
						break;
					}
				}
				if(result == 0)
				{
					if(Type == 'checkbox')
					{

						var p = vid.substring(0, vid.length-2);
						jQuery('#tip_' + p).html('*<i>(Required)</i>');
					}
					else
					{
						jQuery('#tip_' + vid).html('*<i>(Required)</i>');
					}
					$("#beforesend_" + FormID).html('');
					return false;
				}
			}
			else if(Type == 'grid')
			{

				var obj = document.getElementsByName(vid);
				for(var n = 0; n < obj.length; n++)
				{
					if(obj[n].checked == true)
					{
						result = 1;
						break;
					}
				}

				if(result == 0)
				{
					var parr = vid.split('_');
					var pid = '';
					for(var j = 0; j < parr.length -1; j++)
					{
						pid +=  parr[j] + '_';
					}
					pid = pid.substring(0, pid.length-1);

					jQuery('#tip_' + pid).html('*<i>(Required)</i>');
					$("#beforesend_" + FormID).html('');
					return false;
				}
			}

		}
	}

	return true;
}



function GetFormNextStep(formID, step, count)

{
	if(validateStep(formID, step, count))
	{

		$('.page_break_title_' + formID).hide();

		var NextStep = step + 1;

		$('.page_break_' + formID + '_' + step).hide();

		$('.page_break_' + formID + '_' + NextStep).show();

		if((NextStep+1) < count)

		{

			$('.page_break_button_' + formID).html('<a href=\"#here\"  onclick=\"GetFormPrevStep('+formID+', '+NextStep+', '+count+')\"><img src=\"/images/customerform/previous.png\" alt=\"\" border=\"0\" /></a> <a href=\"#here\"  onclick=\"GetFormNextStep('+formID+', '+NextStep+', '+count+')\"><img src=\"/images/customerform/next.png\" alt=\"\" border=\"0\" /></a>');

		}

		else

		{

			$('.page_break_button_' + formID).html('<a href=\"#here\"  onclick=\"GetFormPrevStep('+formID+', '+NextStep+', '+count+')\"><img src=\"/images/customerform/previous.png\" alt=\"\" border=\"0\" /></a> <a href=\"#here\"  onclick=\"SendCustomerForm('+formID+')\"><img src=\"/images/customerform/send_form_build_btn.png\" alt=\"\" border=\"0\" /></a> <span id=\"beforesend_' +formID + '"\"></span>');

		}
	}
}

function GetFormPrevStep(formID, step, count)
{
	var PrevStep = step -1;
	if(PrevStep == 0)
	{
		$('.page_break_title_' + formID).show();
	}
	$('.page_break_' + formID + '_' + step).hide();
	$('.page_break_' + formID + '_' + PrevStep).show();
	if(PrevStep == 0)
	{
		$('.page_break_button_' + formID).html('<a href=\"#here\"  onclick=\"GetFormNextStep('+formID+', '+PrevStep+', '+count+')\"><img src=\"/images/customerform/next.png\" alt=\"\" border=\"0\" /></a>');
	}
	else
	{
		$('.page_break_button_' + formID).html('<a href=\"#here\"  onclick=\"GetFormPrevStep('+formID+', '+PrevStep+', '+count+')\"><img src=\"/images/customerform/previous.png\" alt=\"\" border=\"0\" /></a> <a href=\"#here\"  onclick=\"GetFormNextStep('+formID+', '+PrevStep+', '+count+')\"><img src=\"/images/customerform/next.png\" alt=\"\" border=\"0\" /></a>');
	}
}

function AddtoCart(ProductID, lang)
{
	$.ajax({
		url: "/order_ajax.php",
		type: "POST",
		dataType: "text",
		data: {todo: 'AddtoCart', id: ProductID, lang:lang},
		success: function(data){
			location.href = '/shopcart.php?lang=' + lang;
		},
		error: function(){
			//alert("error");
		}
	});
}
function Click2Call() {
	$.nyroModalManual({url: '/callback.php'});
}


