﻿function $wedding(id) {
	return document.getElementById(id);
}
var blur_logic = 0;
function show(id) {
	document.getElementById(id).style.display = 'block';
}
function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function hide2(id) {
	document.getElementById(id).style.display = 'none';
/* obj = document.getElementById('checkout-payment-method-load').getElementsByTagName("input");
	for(i=0; i<obj.length;i++)
	     obj[i].checked = 'false';*/
		 document.getElementById("p_method_protx_standard").checked = true;
		 document.getElementById("p_method_paypal_standard").checked = false;
		 document.getElementById("p_method_checkmo").checked = false;
}
function CoLeeSelect(thisObj) { // Navigator Drop Down Menu
    var thisinput = thisObj.getElementsByTagName("input");
	var thisul = thisObj.getElementsByTagName("ul");
	var thisli = thisul[0].getElementsByTagName("li");
	if (thisObj.id != "CoLeeSelect") {
    	thisObj.id = "CoLeeSelect";
		thisObj.focus();
		thisul[0].style.display = "block";
		for ( var i = 0; i < thisli.length; i++) {
			thisli[i].onmouseover = function() {
				for ( var j = 0; j < thisli.length; j++) {
					thisli[j].className = "";
				}
				this.className = "";
			}
			thisli[i].onclick = function() {
                if(this.innerText)thisinput[0].value = this.innerText;
                if(this.textContent)thisinput[0].value = this.textContent;
             if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ") thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);
				// ie7�»�ĩβ��һ���ո񣬴˴��ѿո�ȥ��
			/*
			 * if( thisinput[0].value!='Please select...') {
			 * thisinput[0].className = 'nav_select_s';
			 * if(this.id=='pro1'){temp1='';temp1=this.getAttribute("urlkey");}
			 * if(this.id=='pro2'){temp2=this.getAttribute("pro");
			 * temp3=this.getAttribute("cat");} url_link2(); }
			 * 
			 * else { thisinput[0].className = 'nav_select';}
			 */
			// if(this.getAttribute('entertext')&&this.getAttribute('entertext')=='yes') document.getElementById('enter_text').style.display='block';
			  // else document.getElementById('enter_text').style.display='none';
		}
	}
} else {
	ObjBlur();
}
thisObj.onblur = ObjBlur;
function ObjBlur() {
	thisObj.id = "";
	thisul[0].style.display = "none";
	thisObj.blur();
}
}
function OptionSelect(thisObj) {
var thisinput = thisObj.getElementsByTagName("input");

	var thisselect = thisObj.getElementsByTagName("select");

	var thisul = thisObj.getElementsByTagName("ul");
var thisli = thisul[0].getElementsByTagName("li");
if (thisObj.id != "CoLeeSelect") {
	thisObj.id = "CoLeeSelect";
	thisObj.focus();
	thisul[0].style.display = "block";
	for ( var i = 0; i < thisli.length; i++) {
		thisli[i].onmouseover = function() {
			for ( var j = 0; j < thisli.length; j++) {
				thisli[j].className = "";
			}
			this.className = "";
		}
		thisli[i].onclick = function() {			
             if(this.innerText)thisinput[0].value = this.innerText;

                thisselect[0].value = this.getAttribute('value');

                if(this.textContent)thisinput[0].value = this.textContent;
             if( thisinput[0].value.charAt(thisinput[0].value.length-1) == " ") thisinput[0].value =  thisinput[0].value.substr(0,  thisinput[0].value.length-1);

				thisinput[0].value =  thisinput[0].value.substr(0, 25);

			}
	}
} else {
	ObjBlur();
}
thisObj.onblur = ObjBlur;
function ObjBlur() {
	thisObj.id = "";
	thisul[0].style.display = "none";
	thisObj.blur();
}
}
function CoLeeSelect2(thisObj) { // Product View Page -- Font style
var thisinput = thisObj.getElementsByTagName("input");
var thisul = thisObj.getElementsByTagName("ul");
var thisli = thisul[0].getElementsByTagName("li");
if (thisObj.id != "CoLeeSelect") {
	thisObj.id = "CoLeeSelect";
	thisObj.focus();
	thisul[0].style.display = "block";
	for ( var i = 0; i < thisli.length; i++) {
		thisli[i].onmouseover = function() {
			for ( var j = 0; j < thisli.length; j++) {
				thisli[j].className = "";
			}
			this.className = "";
		}
		thisli[i].onclick = function() {
			thisinput[0].value = this.attributes["font"].nodeValue;
		}
	}
} else {
	ObjBlur();
}
thisObj.onblur = ObjBlur;
function ObjBlur() {
	thisObj.id = "";
	thisul[0].style.display = "none";
	thisObj.blur();
}
}

/** ***************** drage div ******/
var _IsMousedown = 0;
var _ClickLeft = 0;
var _ClickTop = 0;
function moveInit(divID,evt)
{
 _IsMousedown = 1;
 if(getBrowserType() == "NSupport")
 {
  return;
 }
 var obj = getObjById(divID);
 if(getBrowserType() == "fox")
 {
  _ClickLeft = evt.pageX - parseInt(obj.style.left);
  _ClickTop = evt.pageY - parseInt(obj.style.top);
 
 }else{
  _ClickLeft = evt.x - parseInt(obj.style.left);
  _ClickTop = evt.y - parseInt(obj.style.top);
 }
}
function Move(divID,evt)
{
 if(_IsMousedown == 0)
 {
  return;
 }
 var objDiv = getObjById(divID);
 if(getBrowserType() == "fox")
 {
  objDiv.style.left = evt.pageX - _ClickLeft+"px";
  objDiv.style.top = evt.pageY - _ClickTop+"px";
 }
 else{
  objDiv.style.left = evt.x - _ClickLeft;
  objDiv.style.top = evt.y - _ClickTop;
 }
 
}
function stopMove()
{
 _IsMousedown = 0;
}
function getObjById(id)
{
 return document.getElementById(id);
}
function getBrowserType()
{
 var browser=navigator.appName
 var b_version=navigator.appVersion
 var version=parseFloat(b_version)
 //alert(browser);
 if ((browser=="Netscape"))
 {
  return "fox";
 }
 else if(browser=="Microsoft Internet Explorer")
 {
  if(version>=4)
  {
   return "ie4+";
  }
  else
  {
   return "ie4-";
  }
 }
 else
 {
  return "NSupport";
 }
}
/** ***************** drage div ******/
/** ******************************* Contact Us Date Section */
function hide_date_list(obj) {

	obj.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("ul")[0].style.display = "none";

}

function show_date_list(obj) {
	obj.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("ul")[0].style.display = "block";

}
function hide_date_list2(obj,evt) {

	obj.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("ul")[0].style.display = "none";

 var e=(evt)?evt:window.event; //判断浏览器的类型，在基于ie内核的浏览器中的使用cancelBubble
		if (window.event) { 
		e.cancelBubble=true; 
		} else { 
		//e.preventDefault(); //在基于firefox内核的浏览器中支持做法stopPropagation
		e.stopPropagation(); 
		} 
}
function show_date_list2(obj,evt) {
obj.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("ul")[0].style.display = "block";
 var e=(evt)?evt:window.event; //判断浏览器的类型，在基于ie内核的浏览器中的使用cancelBubble
		if (window.event) { 
		e.cancelBubble=true; 
		} else { 
		//e.preventDefault(); //在基于firefox内核的浏览器中支持做法stopPropagation
		e.stopPropagation(); 
		} 
}
function doSomething(obj,evt){
	  // obj.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("ul")[0].style.display = "none";
	 // jQuery(".date_ul_m").css("display","block");
	   
	   var e=(evt)?evt:window.event; //判断浏览器的类型，在基于ie内核的浏览器中的使用cancelBubble
		if (window.event) { 
		e.cancelBubble=true; 
		} else { 
		//e.preventDefault(); //在基于firefox内核的浏览器中支持做法stopPropagation
		e.stopPropagation(); 
		} 
		
}


/*****************/
                         /* jQuery(".month").mouseover(function(){
							   jQuery(".date_ul_m").show();
										 jQuery("#help_month").show();
									
								 })		
							jQuery(".month ul ").mouseover(function(event){
										 jQuery(".date_ul_m").show();	
										 jQuery("#help_month").show();	
										  event.stopPropagation(); 
															   });
							jQuery("#help_month").mouseover(function(event){
										 jQuery(".date_ul_m").hide();
										 jQuery("#help_month").hide();
															   });
							jQuery("#help_month").mouseout(function(event){
										 jQuery(".date_ul_m").hide();
										 jQuery("#help_month").hide();
															   });
							jQuery("#date_month").mouseout(function(){
									jQuery(".date_ul_m").hide();	
									jQuery("#help_month").hide();				 
														 })		
							
							jQuery(".day").mouseover(function(){
										jQuery(".date_ul_d").show();
										 jQuery("#help_day").show();
									
								 })		
							jQuery(".day ul ").mouseover(function(event){
										 jQuery(".date_ul_d").show();	
										 jQuery("#help_day").show();	
										  event.stopPropagation(); 
															   });
							jQuery("#help_day").mouseover(function(event){
										 jQuery(".date_ul_d").hide();
										 jQuery("#help_day").hide();
															   });
							jQuery("#help_day").mouseout(function(event){
										 jQuery(".date_ul_d").hide();
										 jQuery("#help_day").hide();
															   });
							
							jQuery("#date_day").mouseout(function(){
									jQuery(".date_ul_d").hide();	
									jQuery("#help_day").hide();				 
														 })	*/

/**
 * Add by Feistel
 * 
 * Used at set hidden date value of contact us form
 * 
 */
function $auto(id) {
return document.getElementById(id);
}

function send_date(obj) { // Factory page date function

	obj.parentNode.parentNode.parentNode.getElementsByTagName("span")[0].innerHTML = obj.innerHTML;
	obj.parentNode.style.display = 'none';
	$auto("hiddenmonth").value = $auto("date_month").innerHTML;	
	$auto("hiddenday").value = $auto("date_day").innerHTML;
	$auto("hiddenyear").value = $auto("date_year").innerHTML;
	jQuery("#help_day").hide();
	jQuery("#help_month").hide();
}
function refresh_list() {
	var c_date = new Date();
	var c_year = c_date.getFullYear();
	var c_month = c_date.getMonth() + 1;
	var c_day = c_date.getDate();
	var month = jQuery("#hiddenmonth").val();
	var year = jQuery("#hiddenyear").val();
	var day_1 = jQuery("#hiddenday").val();

	var day = 31;
	var json = {
			"1":"January",
			"2":"February",
			"3":"March",
			"4":"April",
			"5":"May",
			"6":"June",
			"7":"July",
			"8":"August",
			"9":"September",
			"10":"October",
			"11":"November",
			"12":"December"
	}
	var json2 = {
			"January":"1",
			"February":"2",
			"March":"3",
			"April":"4",
			"May":"5",
			"June":"6",
			"July":"7",
			"August":"8",
			"September":"9",
			"October":"10",
			"November":"11",
			"December":"12"
	}	
	switch (month) {
	case 'January':
		break;
	case 'February':
		if (year % 4 == 0) {
			day = 29;
		} else {
			day = 28;
		}
		break;
	case 'March':
		break;
	case 'April':
		day = 30;
		break;
	case 'May':
		break;
	case 'June':
		day = 30;
		break;
	case 'July':
		break;
	case 'August':
		break;
	case 'September':
		day = 30;
		break;
	case 'October':
		break;
	case 'November':
		day = 30;
		break;
	case 'December':
		break;
	}
	var y_html = '';
	var d_html = '';
	var m_html = '';
	// year html code;
	for ( var i = c_year; i <= 2015; i++) {
		y_html += '<li onclick="send_date(this);refresh_list();"  class="m" style="width:170px">' + i + '</li>';
	}
	// month html code		
      for(var j = 1; j <= 12; j++)
		{			
		
					jQuery(".date_ul_m").css('height','192px');
					jQuery(".date_ul_m").css('overflow-y','scroll');				
					m_html += "<li onclick='send_date(this);refresh_list();' class='m'  style='width:170px'>" + json[j] + "</li>";

		}
	// day html code;

	if(month == json[c_month] && year == c_year)
	{
		if(day_1 < c_day){
			jQuery("#date_day").html(c_day);
			jQuery("#hiddenday").val(c_day);
		}
		for ( var k = 1; k <= day; k++) {
			if (k < 10) {
				d_html += '<li onclick="send_date(this);" class="m">0' + k + '</li>';
			} else {
				d_html += '<li onclick="send_date(this);" class="m">' + k + '</li>';
			}	
		}
		if(day> 5){ 
			jQuery("#date_ul_d").css('height','192px');
			jQuery("#date_ul_d").css('overflow-y','scroll');
		}else{
			jQuery("#date_ul_d").css('overflow-y','hidden');
		}

	}else{
		for ( var k = 1; k <= day; k++) {
			if (k < 10) {
				d_html += '<li onclick="send_date(this);" class="m">0' + k + '</li>';
			} else {
				d_html += '<li onclick="send_date(this);" class="m">' + k + '</li>';
			}	
	}
		jQuery("#date_ul_d").css('overflow-y','scroll');
		jQuery("#date_ul_d").css('height','192px');

	}
	jQuery('.date_ul_y').html(y_html);
	jQuery('.date_ul_m').html(m_html);
	jQuery('#date_ul_d').html(d_html);
}
function change_class(c,i){

	jQuery(".list_ca").css('border', 'none');

	jQuery(".list_ca").css('background', 'none');

	jQuery("#" + c + i).css('border', '1px dotted #CCCCCC');

	jQuery("#" + c + i).css('background', '#eeeeee');

}
/** ***************************** Contact Us Date Section */
  /**************** pop up position -- left right*******************/

 

<!--

var winWidth = 0;

var winHeight = 0;

function findDimensions() //函数：获取尺寸

{

//获取窗口宽度

if (window.innerWidth)

winWidth = window.innerWidth;

else if ((document.body) && (document.body.clientWidth))

winWidth = document.body.clientWidth;

//获取窗口高度

if (window.innerHeight)

winHeight = window.innerHeight;

else if ((document.body) && (document.body.clientHeight))

winHeight = document.body.clientHeight;

//通过深入Document内部对body进行检测，获取窗口大小

if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth)

{

winHeight = document.documentElement.clientHeight;

winWidth = document.documentElement.clientWidth;

}

//结果输出至两个文本框
}

findDimensions();

//调用函数，获取数值

window.onresize=findDimensions; 
function pop_up(w,h,id,boxid){
	WLeft_f2   =   Math.ceil((winWidth   -   w)   /   2  );
    WTop_f2   =   Math.ceil((winHeight   -   h)   /   2   ); 
	if(WTop_f2<0) WTop_f2=10;
	obj_f2 = document.getElementById(id);
    obj_f2.style.left = WLeft_f2 +"px";
    obj_f2.style.top =WTop_f2 +"px";	
}
//-->
