//define some global variables
var TS_INFO={
	email_cannot_empty:'Email address cannot be empty',
	firstname_cannot_empty:'First name cannot be empty',
	lastname_cannot_empty:'Last name cannot be empty',
	name_cannot_empty:'Name cannot be empty',
	authname_cannot_empty:'Card holder name cannot be empty',
	authnumber_cannot_empty:'Card number cannot be empty',
	cvv_cannot_empty:'Card verification value (CVV) cannot be empty',
	inquiry_cannot_empty:'Inquiry cannot be empty',
	enter_product_quantity:'Product quantity cannot be empty',
	enter_product_model:'Product model cannot be empty',
	quantity_must_be_number:'Product quantity must be number',
	suggest_price_format_error:'Suggest price must contain only [0-9.,]',
	subject_cannot_empty:'Subject cannot be empty',
	from_url_cannot_empty:'Please tell where did you find the price?',
	suggest_price_cannot_empty:'You must provide a suggested price.',
	firstname_longer_than_5:'First name must contain 5 characters at least.',
	lastname_longer_than_5:'Last name must contain 5 characters at least.',
	street_cannot_empty:'Street address cannot be empty',
	city_cannot_empty:'City cannot be empty',
	password_cannot_empty:'Password cannot be empty',
	phone_cannot_empty:'Phone cannot be empty',
	password2_cannot_empty:'Retyped password cannot be empty',
	password2_not_match:'Two entered passwords do not match',
	invalid_email:'Invalid email address',
	invalid_phone:'Invalid telephone number',
	enter_your_name:'Please enter your name', 
	password_length_alert:'Password must be at least 4 characters long',
	name_length_alert:'Password must be at least 5 characters long',
	password_format_alert:'Password must have letter and digit only',
	select_country:'Please select a country',
	select_describes:'Please select an occupation or industry',
	select_category:'Please select a category',
	select_gender:'Please select your gender',
	how_find_us:'Please tell us how you find us',
	agree_term_and_conditions:'Please agree to our Terms and Conditions',
	firstname_cannot_empty:'First name cannot be empty',
	lastname_cannot_empty:'Last name cannot be empty',
	company_cannot_empty:'Company name cannot be empty',
	order_number_cannot_empty:'Order number cannot be empty',
	method_not_available_info:'This shipping method is not available for this order. Please select another one.',
	not_the_same_email_twice:'Not the same email twice',
	incorrenct_fax_number:'Invalid fax number',
	incorrenct_telephone_number:'Invalid telephone number',
	can_not_be_empty:'The field Cannot be empty',
	telephone_number_not_be_empty:'Telephone number can not be empty',
	really_want_to_delete_it:'Really want to delete it?',
	dropship_info:'We will ship the order directly to your buyer in your name. Whenever possible, we will use your or your company name and billing address in the shipping documents and buyer will only see us as your logistics partner or your shipping department..',
	markasgift_info:'If possible, we can mail the product to you marked as a gift, which is tax free in some countries.',
	some_info_wrong:'Some checkout information may be incomplete or incorrect. Please review them and try again.',
	rma_popup_info:'Return Merchandise Authorization (RMA) allows a buyer to return wrong or defective item(s) for replacements or warranty services. An RMA is usually issued after tests and troubleshootings with our support team.Please do not return any goods before an RMA is grandted.',
	tc_accesskey_info:'Each support ticket comes with a randomly generated access key. Customer uses the access key to retrieve support ticket information in our website.',
	what_is_accesskey:'You get an accesskey each time you create a support ticket. Your accesskey is available in the support ticket confirmation email. You can use the accesskey to retrieve your support ticket status and to exchange information with our customer support staff.',
	reviews_title_not_be_empty:'Reviews title not be empty',
	reviews_content_not_be_empty:'Reviews content not be empty',
	enquiry_not_be_empty:'Enquiry cannot be empty',
	suggest_price_not_be_empty:'suggest price not be empty',
	quantity_not_be_empty:'Quantity cannot be empty',
	invalid_price_number:'Invalid price number',
	invalid_quantity_number:'Invalid quantity number',
	checkcode_not_be_empty:'Checkcode cannot be empty'
};
$(function(){
	//var moq_tips='Wholesales only,so you can only buy it from Minimum Order Quantity or as sample.';
	//$('.hasmoq').focus(function(){addTip($(this),'<div class="tips"><span>'+moq_tips+'</span></div>');}).blur(function(){$(this).siblings('div.tips').remove();});	
	$('input[type=text],input[type=password]').css({border:'1px solid #ccc',color:'#000'});
	$('textarea').css({border:'1px solid #ccc'});
});
/******************************general javascript functions*********************************************/



function addTip(obj,content){//add tip kit for some element with specified class name
	obj.parent().css({position:'relative'});
	$(content).insertBefore($(obj.siblings().get(0)));
}
function menu_over(idstr){
	var obj = document.getElementById(idstr);
	obj.style.display='block';
}
function menu_out(idstr){
	var obj = document.getElementById(idstr);
	obj.style.display='none';
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=850,screenX=150,screenY=100,left=100')
}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
function cursorMessage(ele,message,tipid,use_alt){
	if ($('#'+tipid).length==0) {
		  $('body').append('<div id="'+tipid+'">&nbsp;</div>');	
		  $('#'+tipid).hide();
	}
	$(ele).mousemove(function(e){
		if(use_alt){
			var show_info=$(this).attr('name').split('|');
			show_info='<div class="gray_bg text_c">'+show_info[0]+'</div><div class="p5">'+show_info[1]+'</div>';
			$('#'+tipid).html(show_info).show().css({left:(e.pageX+5)+'px',top:(e.pageY+22)+'px'});
		}
		else $('#'+tipid).html(message).show().css({left:(e.pageX+5)+'px',top:(e.pageY+22)+'px'});		
	}).mouseout(function(){
		$('#'+tipid).hide();
	});
}
function xhrCursorMessage(element,mscontainer){
	$(element).mouseover(function(e){
		$(element).attr('alt','').attr('title','');
		$('#'+mscontainer).html('&nbsp;<img src="images/theme/default/reading.gif">Loading...').load('cursor_message.php',{keyword:$(this).attr('id')}).show().css({left:(e.pageX+5-getx(e.pageX))+'px',top:(e.pageY+22)+'px'});
	}).mouseout(function(){
		$('#'+mscontainer).hide();
	});
}
function getx(ix){
	var ib=$('body').innerWidth();
	var idiv=ib-ix;
	return parseInt(idiv)<300?300-parseInt(idiv):0;
}
function fix_ie6_zindex(show,container){
	container=container||document
	if($.browser.msie && $.browser.version == 6){ 
		if(show){
			$(container).find('select').show();
		}else{
			$(container).find('select').hide();
		}
	}
}
$(document).ready(function(){
	$('#head_verisign').click(function(){
		dn="WWW.TRADESTEAD.COM";
		lang="en";
		aff="eSignAustraliaLimitedGlobalServer";
		tpt="transparent";
		vrsn_style="WW";
		splash_url="https://seal.verisign.com";
		seal_url="https://seal.verisign.com";
		u1=splash_url+"/splash?form_file=fdf/splash.fdf&dn="+dn+"&lang="+lang;
		u2=seal_url+"/getseal?at=0&&sealid=2&dn="+dn+"&aff="+aff+"&lang="+lang;	
		tbar = "location=yes,status=yes,resizable=yes,scrollbars=yes,width=560,height=500";
		window.open(u1,'VRSN_Splash',tbar);		
	});
	$('.jshidehref').removeAttr('href');
});
