/**
 * @author flexi
 */
 var http;
	
function createRequestObject()	{
	if (window.XMLHttpRequest)
		objXMLHttp=new XMLHttpRequest();
	else if (window.ActiveXObject)
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	return objXMLHttp;
}

function currency_change(id,url)
{
	alert(url)
	window.location='/inc/functions.php?action=currency&id='+id+"&url="+url;
}

function over_continue_button() {
  if (document.images) {
	document["continue_button"].src = button1_over.src
  }
}

function up_continue_button() {
  if (document.images) {
	document["continue_button"].src = button1_up.src
  }
}

function radio_change(id,pesid,row,pres_id,action)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&pesid="+pesid+"&pres_id="+pres_id+"&row="+row,
			success: function(msg){
				jQuery('#prescription_overlay_whole_'+id).html(msg);
			}
	});

}

function additional()
{
	if(document.pres.pes_add.value == 'Additional Details  optional'){
		document.pres.pes_add.value = '';
	}
}

function chkAdditional()
{
	if(document.pres.pes_add.value == ''){
		document.pres.pes_add.value = 'Additional Details  optional';
	}
}

function add_to_compare_carsoul(fid,pid,action,url,glass_id,lens_id,del_len)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"fid="+fid+"&action="+action+"&pid="+pid+"&url="+url+"&glass_id="+glass_id+"&lens_id="+lens_id+"&del_len="+del_len,
			success: function(msg){
			//alert(msg);
			jQuery('#product_carsoul').html(msg);
			}
	});
}

function frame_image_changes(pid,fid,ino,action,compId,viewC)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"fid="+fid+"&action="+action+"&pid="+pid+"&ino="+ino+"&compId="+compId+"&viewC="+viewC,
			success: function(msg){
			//alert(msg);
			document.getElementById('single_frames_'+ino).innerHTML=msg;
			//jQuery('#single_frames_'+ino).html(msg);
			addtocompare_login();
			}
	});
}

/*function frame_image_changesSingle(pid,fid,ino,action,compId,viewC,setSingle)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"fid="+fid+"&action="+action+"&pid="+pid+"&ino="+ino+"&compId="+compId+"&viewC="+viewC+"&setSingle="+setSingle,
			success: function(msg){
			//alert(msg);
			jQuery('#single_frames_'+ino).html(msg);
			}
	});
}*/


function frame_image_changesSingle(pid,fid,ino,action,compId,viewC,setSingle)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"fid="+fid+"&action="+action+"&pid="+pid+"&ino="+ino+"&compId="+compId+"&viewC="+viewC+"&setSingle="+setSingle,
			success: function(msg){
			//alert(msg);
			jQuery('#frameSelectImage').html(msg);
			}
	});
}

function checkout(pid,glass_id)
{
	alert(glass_id)
	$(document).ready(function(){
	$.ajax({
				type: "POST",
				url: "../test.php",
				data: "pid="+pid+"&glass_id="+glass_id,
				success: function(msg){
					alert(msg)
					$('.success').html(msg);
				}
				});
	})
}
function radio_unchange(id,pesid,row,pres_id,action)
	{
		jQuery.ajax({
				type: "POST",
				url: "/inc/functions.php",
				data:"id="+id+"&action="+action+"&pesid="+pesid+"&pres_id="+pres_id+"&row="+row,
				success: function(msg){
					jQuery('#pres_'+id+'_'+pesid).html(msg);
				}
		});
	
	}

function lens_change(lid,id,action)
{
	jQuery('#progressP_'+id).html('<img src="/eyewear-images/loading.gif" border="0" />');
	var xhl =jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"lid="+lid+"&action="+action+"&id="+id,
			success: function(msg){
				var ms = msg.split("@"); 
				jQuery('#lens_div_'+id).html(ms[0]);
				jQuery('#totalprice').html(ms[1]);
				jQuery('#check_lenses').html(ms[2]);
				jQuery('#exclaim_text').html(ms[3]);
				jQuery('#proSinglePrice_'+id).html(ms[4]);
				jQuery('#lens_package_select_'+id).html(ms[5]);
				jQuery('#progressP_'+id).html('');
			}
	});
	
}

function lens_change_SP(lid,id,action)
{
	jQuery('#progress1').html('<img src="/eyewear-images/loading.gif" border="0" />');
	var xhl = jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"lid="+lid+"&action="+action+"&id="+id,
			success: function(msg){
				var ms = msg.split("@");
				jQuery('#lens_div_'+id).html(ms[0]);
				jQuery('#totalprice').html(ms[1]);
				jQuery('#check_lenses').html(ms[2]);
				jQuery('#exclaim_text').html(ms[3]);
				jQuery('#proSinglePrice_'+id).html(ms[4]);
				jQuery('#lens-spec-SP').html(ms[5]);
				jQuery('#lens_package_select_'+id).html(ms[6]);
				jQuery('#progress1').html('');
			}
	});
	
}

function package_update_frame(id,pid,action,inum)
{
	jQuery('#progressL_'+id).html('<img src="/eyewear-images/loading.gif" border="0" />');
	var xhp = jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&inum="+inum,
			success: function(msg){
				var ms = msg.split("@"); 
					jQuery('#lens_package_select_'+id).html(ms[0]);
					jQuery('#totalprice').html(ms[1]);
					jQuery('#chk_frames').html(ms[2]);
					
					jQuery('#exclaim_text').html(ms[3]);
					jQuery('#proSinglePrice_'+id).html(ms[4]);
					jQuery('#progressL_'+id).html('');
			}
	});
}

function package_update_frame_SP(id,pid,action,inum)
{
	jQuery('#progress2').html('<img src="/eyewear-images/loading.gif" border="0" />');
	var xhp = jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&inum="+inum,
			success: function(msg){
				var ms = msg.split("@"); 
					jQuery('#lens_package_select_'+id).html(ms[0]);
					jQuery('#totalprice').html(ms[1]);
					jQuery('#chk_frames').html(ms[2]);
					jQuery('#exclaim_text').html(ms[3]);
					jQuery('#proSinglePrice_'+id).html(ms[4]);
					jQuery('#lens-spec-SP').html(ms[5]);
					jQuery('#progress2').html('');
			}
	});
}

function quantity_update(id,pid,action,i,cartF)
{	
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&i="+i+"&cartF="+cartF,
			success: function(msg){
				var ms = msg.split("@");
				jQuery('#glass' + id).fadeOut('slow');
				jQuery('#compare_frame'+id).html(ms[0]);
				jQuery('#glass' + id).fadeIn('slow');
				jQuery('#totalprice').html(ms[1]);
				window.location='/prescription-glasses/compare-your-glasses';
			}
	});
	
	var idName = "lens_quantity_";
	idName += pid;
	document.getElementById(idName).selectedIndex = i-1;
}

function quantity_update_SP(id,pid,action,i,cartF)
{	
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&i="+i+"&cartF="+cartF,
			success: function(msg){
				window.location = '/prescription-glasses/glasses-usage-options';
			}
	});
}

function discountUpdate(discountUpdate,cartF)
{	
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"action="+discountUpdate+"&cartF="+cartF,
			success: function(msg){
				//var ms = msg.split("@");
				jQuery('#exclaim_text').html(msg);
			}
	});
}

function quantity_update_basket(id,pid,action,i,chk)
{	
	//alert(id+"---"+pid+"+++"+action+"$$$"+i+"###"+chk);
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&i="+i,
			success: function(msg){
				var ms = msg.split("@");
				jQuery('#totalprice1').html(ms[1]);
			}
	});
	
	var idName = "lens_quantity_";
	idName += pid;
	document.getElementById(idName).selectedIndex = i-1;
}

function quantity_update_test(id,pid,action,i)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&action="+action+"&i="+i,
			success: function(msg){
				jQuery('#glass' + id).fadeOut('slow');
				jQuery('#compare_frame'+id).html(msg);
				jQuery('#glass' + id).fadeIn('slow');
			}
	});
}

function delete_glasses(id,del_glass)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+del_glass,
			success: function(msg){
				jQuery('#glass' + id).fadeOut('slow');
				jQuery('#glass' + id).html(msg);
				jQuery('#glass' + id).fadeIn('slow');
			}
	});
}

function update_qty(qty,id,action)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action,
			success: function(msg){
				jQuery('#basket' + id).fadeOut('slow');
				jQuery('#basket' + id).html(msg);
				jQuery('#basket' + id).fadeIn('slow');
			}
	});
}

function remove_compared_frames(pid,sessionID,url)
{
	alert("Removing frame for this section")
	window.location.href="/inc/functions.php?action=remove_compared_frames&pid="+pid+"&sessionID="+sessionID+"&url="+url;
}

function frame_popup(img)
{

	jQuery.ajax({
			type: "POST",
			url: "frame_popup.php",
			data:"img="+img,
			success: function(msg){
				jQuery('#frm_img').html(msg);
			}
	});
}

function del_frame_comparision(id,action,url)
{
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action+"&url="+url,
	success: function(msg){
	jQuery('#compare_frame' + id).fadeOut('slow');
	jQuery('#compare_frame' + id).html(msg);
	jQuery('#compare_frame' + id).fadeIn('slow');
	}
	});
}

function del_overlay_comparision(id,action,url,pid,fid)
{
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"id="+id+"&action="+action+"&url="+url+"&pid="+pid+"&fid="+fid,
		success: function(msg){
				var ms = msg.split("@");
				jQuery('#shortlistContents').fadeOut('slow');
				jQuery('#shortlistContents').html(ms[0]);
				jQuery('#shortlistContents').fadeIn('slow');
				jQuery('#shortlistContents').css('float','left');
				jQuery('.numberofitems').html(ms[1]);
				//document.getElementById('shortlistCount').innerHTML=ms[1];
				jQuery('#product_shortlist_frames').html(ms[2]);
				jQuery('#link2').html(ms[3]);
				jQuery('#shortlist_view_compare').html(ms[4]);
				jQuery('.shortlist_fixed').html(ms[5]);
				document.getElementById('frameshortlist_'+fid).innerHTML=ms[6];
				//jQuery('#frameshortlist_'+id).html(ms[6]);
				//jQuery('#contentWrapper').find('#frameshortlist_'+id).html(ms[6]);
				
				//tb_remove();
		}
	});
}

function del_frame_basket(id,action,url)
{
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"id="+id+"&action="+action+"&url="+url,
		success: function(msg){
			var ms = msg.split("@");
			jQuery('#cartList').fadeOut('slow');
			jQuery('#cartList').html(ms[1]);
			jQuery('#cartList').fadeIn('slow');
			jQuery('#totalprice1').html(ms[0]);
			jQuery('#link2').html(ms[2]);
			jQuery('#basketCount').html(ms[3]);
			jQuery('#basket_display').html(ms[4]);
			jQuery('#basket_compare').html(ms[5]);
			jQuery('.select_top_common').html(ms[6]);
			jQuery('#select_bottom').html(ms[6]);
			jQuery('#exclaim_text_basket').html(ms[7]);
			ms[7]=$.trim(ms[7]);
			if(ms[7] == 'Basket empty'){
			jQuery('#special_message_basket').css('display','none');
			}else{
			jQuery('#special_message_basket').css('display','block');	
			}
			ms[8]=$.trim(ms[8]);
			jQuery('.view_thickbox_basket').attr("href", ms[8]);

		}
	});
}

function del_frame_basket_pres(id,action,url)
{
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"id="+id+"&action="+action+"&url="+url,
		success: function(msg){
			var ms = msg.split("@");
			jQuery('#cartList').fadeOut('slow');
			jQuery('#cartList').html(ms[1]);
			jQuery('#cartList').fadeIn('slow');
			jQuery('#totalprice1').html(ms[0]);
			jQuery('#link2').html(ms[2]);
			//jQuery('#basketCount').html(ms[3]);
			jQuery('#totalprice').html(ms[4]);
			jQuery('#multiPurchaseDiscount').html(ms[5]);
		}
	});
}

function del_frame_prev_added(id,action,url)
{
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"id="+id+"&action="+action+"&url="+url,
		success: function(msg){
			var ms = msg.split("@");
			jQuery('#cartList').fadeOut('slow');
			jQuery('#cartList').html(ms[1]);
			jQuery('#cartList').fadeIn('slow');
			jQuery('#totalprice1').html(ms[0]);
			jQuery('#link2').html(ms[2]);
			//jQuery('#basketCount').html(ms[3]);
			jQuery('#totalprice').html(ms[4]);
			jQuery('#multiPurchaseDiscount').html(ms[5]);
		}
	});
}

function delete_lens_carsoul(fid,id,action,url)
{
	//alert(prod_id);
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action+"&url="+url+"&fid="+fid,
	success: function(msg){
		window.location = url;
	}
	});
}

function delete_pres_frames(fid,id,action,url,uid,sid)
{
	//alert(prod_id);
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action+"&url="+url+"&fid="+fid+"&uid="+uid+"&sid="+sid,
	success: function(msg){
		var ms = msg.split("@");
		window.location = url+'#bottom_anchor';
		jQuery('#presProdList').fadeOut('slow');
		jQuery('#presProdList').html(ms[0]);
		jQuery('#presProdList').fadeIn('slow');
		document.getElementById('checkPresGender').value = ms[1];
		document.getElementById('cntProduct').value = ms[2];
		jQuery('#basketCount').html(ms[3]);
		jQuery('#totalprice').html(ms[4]);
		jQuery('#basket_display').html(ms[5]);
	}
	});
}


function del_frame_carsoul_comparision(id,action)
{
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action,
	success: function(msg){
		jQuery('#compare_frame' + id).fadeOut('slow');
		jQuery('#compare_frame' + id).html(msg);
		jQuery('#compare_frame' + id).fadeIn('slow');
	}
	});
}


function frame_color_image(img,pid)
{
	document.getElementById('img_src'+pid).src=img;
}

/*function frame_text_image(pid,id,action,url)
{
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action+"&pid="+pid+"&url="+url,
	success: function(msg){
	jQuery('#frame_pid_change' + pid).html(msg);
	}
	});
}*/
function frame_text_image(id,pid,action,url2)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&pid="+pid+"&url2="+url2,
			success: function(msg){
			//	alert(msg);
				jQuery('#product_box_'+pid).html(msg);
			}
	});
}
function frame_text_image_varifocal(pid,id,action,url)
{
	jQuery.ajax({
	type: "POST",
	url: "/inc/functions.php",
	data:"id="+id+"&action="+action+"&pid="+pid+"&url="+url,
	success: function(msg){
	jQuery('#frame_pid_change' + pid).html(msg);
	}
	});
}

function login_details()
{
	var email = document.login.email.value;
	var pass = document.login.pass.value;
	var action = "login_detail";
	jQuery(document).ready(function(){
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"email="+email+"&pass="+pass+"&action="+action,
			success: function(msg){
				jQuery('#shipping_info').html(msg);
				//jQuery('#login_error').show();
			}
	});
	});
}
function proceed_frames(id,fid,pid,action)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&fid="+fid+"&pid="+pid+"&action="+action,
			success: function(msg){
				var ms = msg.split("@"); 
				jQuery('#frame_glasses_expand_retract').html(ms[0]);
				jQuery('#change_button' + fid).fadeOut('slow');
				jQuery('#change_button' + fid).html(ms[1]);
				jQuery('#change_button' + fid).fadeIn('slow');
			}
	});
}

function proceed_frames_delete(id,fid,pid,action)
{
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"id="+id+"&fid="+fid+"&pid="+pid+"&action="+action,
		success: function(msg){
			var ms = msg.split("@"); 
			jQuery('#frame_glasses_expand_retract').html(ms[0]);
			jQuery('#change_button' + fid).fadeOut('slow');
			jQuery('#change_button' + fid).html(ms[1]);
			jQuery('#change_button' + fid).fadeIn('slow');
	}
	});
}

function tint_update_frame(id,action,inum,pid)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&inum="+inum+"&pid="+pid,
			success: function(msg){
				var ms = msg.split("@@"); 
				jQuery('#lens_tint_select__'+id).html(ms[0]);
				jQuery('#totalprice').html(ms[1]);
				jQuery('#exclaim_text').html(ms[2]);
				jQuery('#proSinglePrice_'+id).html(ms[3]);
			}
	});
}

function tint_update_frame_SP(id,action,inum,pid)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&inum="+inum+"&pid="+pid,
			success: function(msg){
				var ms = msg.split("@@"); 
				jQuery('#lens_tint_select__'+id).html(ms[0]);
				jQuery('#totalprice').html(ms[1]);
				jQuery('#exclaim_text').html(ms[2]);
				jQuery('#proSinglePrice_'+id).html(ms[3]);
				jQuery('#lens-spec-SP').html(ms[4]);
			}
	});
}

function prescription_pd(id,glasses,gender,action,presid)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&glasses="+glasses+"&gender="+gender+"&action="+action+"&presid="+presid,
			success: function(msg){
				var ms = msg.split("@");
				jQuery('#prescription_overlay_whole_'+id).html(ms[0]);
				document.getElementById('pres_product_'+id).style.borderTop = '1px dotted #CCCCCC';
				document.getElementById('pres_product_'+id).style.borderBottom = '1px dotted #CCCCCC';
				document.getElementById('checkPresGender').value = ms[1];
				jQuery('#continuePresButton').html(ms[2]);
			}
	});
}
function prescriptionSingle_pd(id,glasses,gender,action,presid)
{
	/*var btn_border = document.getElementById('btnBorder').value;
	if(btn_border < 1){
		document.getElementById('prescription-1').style.border = '1px solid red';
	}*/
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&glasses="+glasses+"&gender="+gender+"&action="+action+"&presid="+presid,
			success: function(msg){
				jQuery('#prescription_overlay_whole_'+id).html(msg);
				jQuery('#btnReplace').html('<img id="continue_button" onMouseOver="over_continue_button();" onMouseOut="up_continue_button();" name="continue_button" src="/eyewear-images/prescription/glasses-continue-up.jpg" border="0" onClick="return checkPrescriptionValue();" />');
				document.getElementById('bottom_anchor').style.border = '1px solid red';
			}
	});
}

function add_prescription(num,action)
	{
		$.ajax({
				type: "POST",
				url: "/inc/functions.php",
				data:"num="+num+"&action="+action,
				success: function(msg){
					$('#myDivPrescription').html(msg);
				}
		});
	}
	
	
function checkBilling()
{
	var obj = document.getElementById("billing_same");
	var obj1 = document.getElementById("billing");
	if(obj.checked == false) {
		obj1.style.display = '';
		document.getElementById('deliveryAddress').style.border="1px solid red";
	} else {
		obj1.style.display = 'none';	
	}
}

function repeat_order_history(id,action)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action,
			success: function(msg){
				jQuery('#order_table_structure').html(msg);
			}
	});
}
function online_prescription_choice(id,action,userid,nxt)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&userid="+userid+"&nxt="+nxt,
			success: function(msg){
				jQuery('#prescription_online_form').html(msg);
			}
	});
}

function online_prescription_remove(id,action,userid)
{
	jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&action="+action+"&userid="+userid,
			success: function(msg){
				jQuery('#prescription_online_form').html(msg);
			}
	});
}

function changeCurrencyCode(sid,uid,basePath,rURI,action){
	var thisVal = document.getElementById('currencyDropdown').value;
	jQuery.ajax({
		type: "POST",
		url: "/inc/functions.php",
		data:"sid="+sid+"&uid="+uid+"&action="+action+"&code="+thisVal,
		success: function(msg){
			window.location=basePath+rURI;
		}
	});
}

function privacyandpolicy()
{
	if(document.termsandconditions.terms[0].checked)
	{
		//alert('yes');
	}
}


function showMirror(glassesID){
	mirrorVisible = 1;
	updateMirrorPosition();
	jQuery("#mirrorHolderDiv").fadeTo(200, 1);
	if(glassesID != undefined){
		loadGlasses(glassesID,0,0)
	}
}

function loadGlasses(glassesID){
	updateMirrorPosition();
	if(flashObj){
		flashObj.loadGlasses(glassesID,0,0)
	}else{
		setTimeout("loadGlasses("+glassesID+")", 250);	
	}
	//doDebug();
}

function hideMirror(){
	mirrorVisible = 0;
	jQuery("#mirrorHolderDiv").fadeTo(200, 0.1, function(){jQuery("#mirrorHolderDiv").css("top", -600);});
}

function doDebug(){
	objInfo = "";
	for(x in flashObj){
		objInfo += x + " : " + flashObj[x] + "<BR>";
	}
	jQuery("#debugDiv").html(objInfo);
}
function updateMirrorPosition(){
	if(mirrorVisible == 0){return false;}
	wh = Math.round(jQuery(window).height()/2);
	mh = Math.round(jQuery("#mirrorHolderDiv").height()/2);
	jQuery("#mirrorHolderDiv").css("top", wh-mh+jQuery(window).scrollTop())
}

function focusWindow(){
	document.focus();
}

function isSpaceKey(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	 if ((charCode < 31) || (charCode > 47 && charCode < 58 ) || (charCode > 96 && charCode <123) || (charCode > 64 && charCode <91) || (charCode ==32))
		return true;
	return false;
}

function isNumberKeyUp(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}

function addShortlist(id,pid,glassid,lensid,action,url){
	jQuery('#frameshortlist_'+id).html('<img src="/eyewear-images/ajax-loader.gif" border="0" class="loding_image" />');
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&glass_id="+glassid+"&lens_id="+lensid+"&action="+action,
			success: function(msg){
			//alert(msg);
			var ms = msg.split("@");
			
				jQuery('.numberofitems').html(ms[0]);
				//document.getElementById('shortlistCount').innerHTML=ms[0];
				jQuery('#product_shortlist_frames').html(ms[1]);
				jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);
				ms[5]=$.trim(ms[5]);
				jQuery('.view_thickbox_basket').attr("href", ms[5]);
			}
		});
	
}
function addShortlist_details(id,pid,glassid,lensid,action,url){
	jQuery('#frameshortlist_'+id).html('<img src="/eyewear-images/ajax-loader.gif" border="0" class="loding_image" />');
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"id="+id+"&pid="+pid+"&glass_id="+glassid+"&lens_id="+lensid+"&action="+action,
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('.numberofitems').html(ms[0]);
				//document.getElementById('shortlistCount').innerHTML=ms[0];
				jQuery('#product_shortlist_frames').html(ms[1]);
				jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);
				
			}
		});

}
function addtocompare_login(){
	
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"action=addtocompare_login",
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('#frame-section').html(ms[0]);
				jQuery('#basket_compare').html(ms[1]);
				jQuery('#basket_display').html(ms[2]);
				jQuery('#exclaim_text_basket').html(ms[3]);
				ms[3]=$.trim(ms[3]);
				if(ms[3] == 'Basket empty'){
				jQuery('#special_message_basket').css('display','none');
				}else{
				jQuery('#special_message_basket').css('display','block');
				}
			}
		});

}
function addtoshortlist_compare(cid,action){
	
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"cid="+cid+"&action="+action,
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('#frame-section').html(ms[0]);
				jQuery('#basket_compare').html(ms[1]);
				jQuery('.select_top_common').html(ms[2]);
				jQuery('#select_bottom').html(ms[2]);
				//jQuery('#exclaim_text').html(ms[3]);
				//if(ms[3] != 'Shortlist empty'){
					//document.getElementById('special_message2').style.display = 'block';
					//jQuery('#exclaim_text').html(ms[3]);
				//}else{
					//document.getElementById('special_message2').style.display = 'none';
				//}
				jQuery('#basket_display').html(ms[4]);
				jQuery('#exclaim_text_basket').html(ms[5]);
				ms[5]=$.trim(ms[5]);
				if(ms[5] == 'Basket empty'){
				jQuery('#special_message_basket').css('display','none');
				}else{
				jQuery('#special_message_basket').css('display','block');
				}
				/*jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);*/
				
			}
		});

}
function addtoshortlist_compare_all(action){
	
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"action="+action,
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('#basket_compare').html(ms[1]);
				jQuery('#frame-section').html(ms[0]);
				jQuery('.select_top_common').html(ms[2]);
				jQuery('#select_bottom').html(ms[2]);
				//jQuery('#exclaim_text').html(ms[3]);
				//if(ms[3] != 'Shortlist empty'){
					//document.getElementById('special_message2').style.display = 'block';
					//jQuery('#exclaim_text').html(ms[3]);
				//}else{
					//document.getElementById('special_message2').style.display = 'none';
				//}
				jQuery('#basket_display').html(ms[4]);
				jQuery('#exclaim_text_basket').html(ms[5]);
				ms[5]=$.trim(ms[5]);
				if(ms[5] == 'Basket empty'){
				jQuery('#special_message_basket').css('display','none');
				}else{
				jQuery('#special_message_basket').css('display','block');
				}
				/*jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);*/
				
			}
		});

}
function addtobasket_compare(cid,action){
	
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"cid="+cid+"&action="+action,
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('#frame-section').html(ms[0]);
				jQuery('#basket_compare').html(ms[1]);
				jQuery('.select_top_common').html(ms[2]);
				jQuery('#select_bottom').html(ms[2]);
				//if(ms[3] != 'Shortlist empty'){
					//document.getElementById('special_message2').style.display = 'block';
					//jQuery('#exclaim_text').html(ms[3]);
				//}else{
					//document.getElementById('special_message2').style.display = 'none';
				//}
				jQuery('#basket_display').html(ms[4]);
				jQuery('#exclaim_text_basket').html(ms[5]);
				ms[5]=$.trim(ms[5]);
				if(ms[5] == 'Basket empty'){
				jQuery('#special_message_basket').css('display','none');
				}else{
				jQuery('#special_message_basket').css('display','block');
				}
				/*jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);*/
				
			}
		});

}
function removeshortlist_compare(cid,action){
	
		jQuery.ajax({
			type: "POST",
			url: "/inc/functions.php",
			data:"cid="+cid+"&action="+action,
			success: function(msg){
			
			var ms = msg.split("@");
				jQuery('#frame-section').html(ms[0]);
				//jQuery('#basket_compare').html(ms[1]);
				//jQuery('.select_top_common').html(ms[2]);
				//jQuery('#select_bottom').html(ms[2]);
				jQuery('#exclaim_text').html(ms[1]);
				/*jQuery('#shortlist_view_compare').html(ms[2]);
				jQuery('.shortlist_fixed').html(ms[3]);
				jQuery('#frameshortlist_'+id).html(ms[4]);*/
				
			}
		});

}

function addShortlist_close(){
	tb_remove();
	/*tb_show('',url+'?width=800&height=510&inlineId=displayWarning','');
	var t=setTimeout("addShortlist_close()",3000);*/
	/*window.location.reload();*/
}

function leftnavloader(id){
	
	document.getElementById('leftloading_'+id).style.display = 'block';
}

