// JavaScript Document
function putEnlargeContent(itemName,itemCode,imageName){
	document.images.large.src= "phpthumb/phpthumb.php?src=../images/productImages/"+imageName+"&w=300&h=300";
	document.getElementById('itemName').innerHTML=itemName;
	document.getElementById('itemCode').innerHTML=itemCode;
}
function showHideUnitPrice(id)
{
	if(id==5){
		document.getElementById("parcelPrice").style.display="";
		document.getElementById("singleSetPrice").style.display="none";
	}else{
		document.getElementById("parcelPrice").style.display="none";
		document.getElementById("singleSetPrice").style.display="";
	}
}
/*start for popup*/
function showHideBlogCommentBox(id,w,h){
//alert(id);
obj=document.getElementById(id);
openModalDialog(obj.innerHTML,w,h);
}
function openModalDialog(html,w,h) {
	win = new Window('modal_window', {className: "alert", title: "", zIndex:0,height:h,width:w, opacity:1, resizable: false })
	win.setDestroyOnClose();		    
	win.showCenter(true);
	win.setHTMLContent(html);
	//if(!width)
	//    width=250;
	//if(!height)
	//    height=350;
	//win.setSize(width,height);
}  
function closeAll()
{
	Windows.closeAll();
}

function openWindow(filename) {
	popupWin = window.open(filename,'EIN','scrollbars,resizable,toolbar,width=470,height=250,left=100,top=100');
	popupWin.focus();
}

function testCert(textboxId){//for shopping Cart page.
	document.getElementById("mode").value="gemtest";
	if(!isNaN(document.getElementById(textboxId).value) && (document.getElementById(textboxId).value)>4){
		document.frmShoppingCart.submit();
		return true;
	}else{
		alert("Please enter 5 or more pieces!");
		document.getElementById(textboxId).focus();
		document.getElementById(textboxId).select();
		return false;
	}
}
function testCert1(textboxId){//for product details page
	if(document.getElementById("txtcertificate").checked==true){
		if(document.getElementById(textboxId)){
			if(!isNaN(document.getElementById(textboxId).value) && (document.getElementById(textboxId).value)>4){
				return true;
			}else{
				alert("Please enter 5 or more pieces!");
				document.getElementById(textboxId).focus();
				document.getElementById(textboxId).select();
				return false;
			}
		}
	}
	return true;
}
function ShowHide(div1){

if(document.getElementById(div1).style.display=="none"){
document.getElementById(div1).style.display="block";
}else{
document.getElementById(div1).style.display="none";
}
}

function ShowHidePrdDet(div1){
	if(document.getElementById("view1")){
		document.getElementById("view1").style.display="none";
	}
	if(document.getElementById("view2")){
		document.getElementById("view2").style.display="none";
	}
	if(document.getElementById("view3")){
		document.getElementById("view3").style.display="none";
	}
	document.getElementById(div1).style.display="block";
}

function disableQuantityBox(){
	if(document.getElementById("quanGemTest")){
		if(document.getElementById("txtcertificate").checked==true){
			document.getElementById("quanGemTest").disabled=false;
		}else{
			document.getElementById("quanGemTest").disabled=true;
		}
	}
}

function textboxClick(txtboxId,txtmsg){
	if(txtboxId.value==txtmsg){
		txtboxId.value='';
		txtboxId.style.color='#444444';
	}
}
function txtboxBlur(txtboxId,txtmsg){
	if(txtboxId.value==''){
		txtboxId.value=txtmsg;
		txtboxId.style.color='#6c6c6c';
	}
}

/*start of wishlist page*/
function triggerAllWish(boxId,status){
	if(status==true){
		document.getElementById("hdnwishrem"+boxId).value=1;
	}else{
		document.getElementById("hdnwishrem"+boxId).value=0;
	}
}
function selectAllWish(){
	var elName;
	frm=document.getElementById('mywishlist');
	for (i = 0; i<frm.elements.length; i++){
		elName=frm.elements[i].name;
		elId=frm.elements[i].id;
		if(elName!="checkcode"){
			document.getElementById(elId).value=1;
			document.getElementById('wishrem'+elName).checked=true;
		}
	}
}
function deSelectAllWish(){
	var elName;
	frm=document.getElementById('mywishlist');
	for (i = 0; i<frm.elements.length; i++){
		elName=frm.elements[i].name;
		elId=frm.elements[i].id;
		if(elName!="checkcode"){
			document.getElementById(elId).value=0;
			document.getElementById('wishrem'+elName).checked=false;
		}
	}
}
function wishListSubmit(){
	var elName;
	var onechecked=false;
	frm=document.getElementById('mywishlist');
	for (i = 0; i<frm.elements.length; i++){
		elName=frm.elements[i].name;
		elId=frm.elements[i].id;
		if(elName!="checkcode"){
			if(document.getElementById('wishrem'+elName).checked==true){
				onechecked=true;
			}
		}
	}
	if(onechecked==true){
		if(confirm('Are you sure you want to remove the item(s)?')){
			document.mywishlist.submit();
		}
	}else{
		alert('Please first check the tick box to remove the item(s)!');
	}
}

function shoppingCartSubmit(){
	document.getElementById('mode').value='remove';
	var elName;
	var onechecked=false;
	frm=document.getElementById('frmShoppingCart');
	for (i = 0; i<frm.elements.length; i++){
		elName=frm.elements[i].name;
		elId=frm.elements[i].id;
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked==true){
				onechecked=true;
			}
		}
	}
	if(onechecked==true){
		if(confirm('Are you sure you want to remove the item(s)?')){
			frm.submit();
		}
	}else{
		alert('Please first check the tick box to remove the item(s)!');
	}
}
/*end of wishlist page*/
/*end for popup*/