// ITEM SEARCH FUNCTIONS

function checkAllColor(str1,str2,num)

	{

	document.getElementById(str2).checked=false

	for(mm=0;mm<num;mm++)

		{

		if(document.getElementById(str1+mm).checked==false)

			return;

		}

	document.getElementById(str2).checked=true	

	}



function deleteSelectedItem(id)

	{

	if(!confirm("Are you sure you want to delete this item."))

		return;

	document.myform.tmode.value="Delete"

	document.myform.selid.value=id

	document.myform.submit()

	}



function startItemSearch()

	{

	document.myform.tmode.value=""

	document.myform.selid.value=0

	document.myform.submit()

	}





// INQUIRY

function showInquiryForm(id)

	{

	openClientWindow("inquiry_item.php","&itemid="+id,400,400,200,100,"itemenq_"+id)

	}



// DETAILED

function showDetailedForm(id)

	{

	window.location.href="main.php?pagename=card_details.php&itemid=" + id

	}



// BULK ORDER

function showBulkOrderForm(id)

	{

	window.location.href="main.php?pagename=bulk_order_merged.php&itemid=" + id

	}

// BULK ORDER

function showStockOrderForm(id)

	{

	window.location.href="main.php?pagename=stock_order_merged.php&itemid=" + id

	}



// ENLARGE IMAGE

var dispatlast=0

function enlargeImage(obj,imgn,ccode)

	{

	var eobj=document.getElementById("endiv")

	eobj.style.visibility="visible"

	eobj.style.top=document.body.scrollTop

	if(brname=="micro")

		eobj.style.filter="alpha(opacity=80)"

	else

		eobj.style.opacity=0.6



	eobj.style.height=document.body.offsetHeight

	document.getElementById("photodiv").style.width=0

	document.getElementById("photodiv").style.left=480

	animatePhotoDiv()

	document.getElementById("photodiv").innerHTML=

	document.getElementById("photodiv").style.visibility="visible"

	document.getElementById("photodiv").style.top=document.body.scrollTop+50

	

	temp="<table align=center width=100% height=100% border=0>"

	temp+="<tr>"

	temp+="<td align=center valign=middle><img src=images/ajax-loader.gif><br>Please wait....</td>"

	temp+="</tr>"

	temp+="</table>"

	document.getElementById("photodiv").innerHTML=temp



	temp="<table align=center width=100% height=100% border=0>"

	temp+="<tr>"

	temp+="<td height=20 class=clsTableData><b>Card Code: </b>" + ccode + "</td>"

	temp+="<td height=20 align=right><a href='javascript:clearEnlarge()'>CLOSE</a></td>"

	temp+="</tr>"

	temp+="<tr>"

	temp+="<td valign=middle colspan=2>" + "<center><img src="+imgn+"></center>" + "</td>"

	temp+="</tr>"

	temp+="</table>"

	dispatlast=0

	displayAtLast(temp)

	//document.getElementById("photodiv").innerHTML=temp

	}



function displayAtLast(t1)

	{

	//window.status=t

	if(dispatlast<15)

		{

		dispatlast++;

		setTimeout("displayAtLast(\"" + t1 + "\")",100)

		}

	else

		{

		document.getElementById("photodiv").innerHTML=t1

		}

	

	}



function animatePhotoDiv()

	{

	if(parseInt(document.getElementById("photodiv").style.width)<800)

		{

		document.getElementById("photodiv").style.width=parseInt(document.getElementById("photodiv").style.width)+100

		document.getElementById("photodiv").style.left=parseInt(document.getElementById("photodiv").style.left)-42

		setTimeout("animatePhotoDiv()",100)

		}

	}





function clearEnlarge()

	{

	document.getElementById("endiv").style.visibility="hidden"

	document.getElementById("photodiv").style.visibility="hidden"

	}



function getCartItemsCount(tp,elem)

	{

	var lRand = Math.random();

	var a=getResponseText("xml_functions.php?func=scartcnt&rand="+lRand)

	if(tp=="ret")	

		document.getElementById(elem).innerHTML="<a href=main.php?pagename=shopping_cart.php><b>Sample Cart ("+a+" Items)</b></a>";

	else

		document.getElementById(elem).innerHTML="<a href=main.php?pagename=shopping_cart.php><b>Sample Cart (" + a + " items)</b></a>"

	}





function getShippingCost(scountry,shiptype)

	{

	//if(shiptype.selectedIndex==0)

	//	document.getElementById("shipcostrow").style.display="none"

	//else

		document.getElementById("shipcostrow").style.display=""

	var country=scountry.options[scountry.selectedIndex].value

	var stype=shiptype.options[shiptype.selectedIndex].value

	var lRand = Math.random();

	var a=getResponseText("xml_functions.php?func=scost&wt="+totalweight+"&country="+country+"&stype="+stype+"&rand="+lRand)



	var temp=a.split(",")

	

	var inrvalue=totalinr+parseFloat(temp[0])

	var usdvalue=totalusd+parseFloat(temp[1])



	document.getElementById("shipcost").innerHTML=Math.round(temp[1],2).toFixed(2)

	document.getElementById("grandtotal").innerHTML=usdvalue.toFixed(2)

	document.getElementById("grandtotalinr").innerHTML=inrvalue

	}



function admin_OrderDetails(id,tp)

	{

	if(tp=="Sample")

		openClientWindow("order_details.php","&orderid="+id,800,600,0,0,"orddet_"+id)	

	else

		openClientWindow("order_details.php","&orderid="+id,800,600,0,0,"orddet_"+id)	

	}



function admin_CustomerOrders(id)

	{

	openClientWindow("customer_orders.php","&clientid="+id,1000,600,0,0,"custord_"+id)	

	}



function changePhoto(id)

	{

	openClientWindow("change_photo.php","&clientid="+id,400,100,200,250,"cphoto_"+id)

	}



function showOtherItemsDescription(id)

	{

	openClientWindow("other_items_desc.php","&itemid="+id,500,400,0,0,"itemdesc"+id)

	}



function admin_viewImages(id)

	{

	openClientWindow("view_item_images.php","&itemid="+id,600,600,0,0,"viewimage_"+id)	

	}



function showBulkItemDetails(id)

	{

	openClientWindow("order_details.php","&orderid="+id,800,600,0,0,"orddet_"+id)

	//openClientWindow("item_details_bulk.php","&itemid="+id,600,600,0,0,"bulkdet_"+id)

	}



function costCalculator(id)

	{

	openClientWindow("card_calculator.php","&itemid="+id,500,600,0,0,"card_cal_"+id)

	}