function check_advanced_search(kw)  {
  error = 0;
  if (kw.length < 3) {
    error_message = "Please enter atleast 3 characters for search";
    error = 1;
  }
  if (error == 1) {
    alert(error_message);
    return false;
  } else {
    return true;
  }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,'width=600,height=330');
}
document.write('<DIV CLASS="doff" ALIGN="center" ID="message2" STYLE="top: 0px; left: 0px; z-index: 5000;"><div id="divheight" class="hnew"><img src="gifs/zero.gif" height="1" width="1"><br></div><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%" ID="tableheight"> <TR> <TD ALIGN="CENTER"><DIV CLASS="main4" ALIGN="CENTER"> <FORM METHOD="post" STYLE="margin:0px;"ACTION="http://www.indiangiftsportal.com/product_info.php?action=add_update_product"> <DIV CLASS="up-heada-1" ALIGN="CENTER"><A HREF="javascript:blowup_off()"><IMG SRC="gifs/close.gif" ALIGN="RIGHT" WIDTH="21" HEIGHT="18" BORDER="0"></A><B ID="prname"></B></DIV> <DIV CLASS="main-tab" ALIGN="LEFT"><IMG SRC="gifs/zero.gif" WIDTH="1" HEIGHT="10"><BR> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" ALIGN="CENTER"> <TR> <TD VALIGN="TOP"><IMG SRC="gifs/zero.gif" WIDTH="10" HEIGHT="1"></TD> <TD VALIGN="TOP"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="418"> <TR> <TD><IMG SRC="gifs/left-corner-top.gif"></TD> <TD BACKGROUND="gifs/top-center.gif" WIDTH="100%"></TD> <TD><IMG SRC="gifs/top-right.gif"></TD> </TR> <TR> <TD BACKGROUND="gifs/center-left.gif"></TD> <TD WIDTH="400" HEIGHT="400" ALIGN="CENTER"> <DIV ID="loadimg" STYLE="font-family: arial; font-size: 15px;" CLASS="doon"><IMG SRC="gifs/indicator-new.gif"><BR> <BR> Loading...</DIV> <DIV ID="imagediv" CLASS="doff" ALIGN="CENTER"></DIV></TD> <TD BACKGROUND="gifs/center-right.gif"></TD> </TR> <TR> <TD><IMG SRC="gifs/bottom-left.gif"></TD> <TD BACKGROUND="gifs/bottom-center.gif"></TD> <TD><IMG SRC="gifs/bottom-right.gif"></TD> </TR> </TABLE><BR> </TD> <TD VALIGN="TOP"><IMG SRC="gifs/zero.gif" WIDTH="10" HEIGHT="1"></TD> <TD VALIGN="TOP" WIDTH="100%"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR> <TD><IMG SRC="gifs/s-left.gif" ></TD> <TD BACKGROUND="gifs/s-top-center.gif"></TD> <TD><IMG SRC="gifs/s-top-right.gif" ></TD> </TR> <TR> <TD BACKGROUND="gifs/s-center-left.gif"></TD> <TD WIDTH="100%"> <SPAN ID="size"></SPAN> <SPAN ID="weight"></SPAN> <DIV CLASS="txt-n22"><SPAN ID="price"></SPAN> <INPUT ALT=" Buy Now " SRC="/myshop/gifs/buynow1.gif" TYPE="image" VSPACE="2" BORDER="0" ALIGN="ABSMIDDLE" HSPACE="7"></DIV></TD> <TD BACKGROUND="gifs/s-center-right.gif"></TD> </TR> <TR> <TD><IMG SRC="gifs/s-bottom-left.gif"></TD> <TD BACKGROUND="gifs/s-bott-center.gif"></TD> <TD><IMG SRC="gifs/s-botom-right.gif" ></TD> </TR> </TABLE><IMG SRC="gifs/zero.gif" WIDTH="1" HEIGHT="8"><BR> <DIV CLASS="txt-n1" id="note1"></DIV> <DIV CLASS="txt-n1" id="note2"></DIV> <DIV CLASS="txt-n1" id="note3"></DIV> <DIV CLASS="txt" ALIGN="JUSTIFY" ID="desc"></DIV> <DIV><INPUT ALT=" Buy Now " SRC="/myshop/gifs/buynow1.gif" BORDER="0" TYPE="image" ></DIV> </TD> <TD VALIGN="TOP"><IMG SRC="gifs/zero.gif" WIDTH="10" HEIGHT="1"></TD> </TR> </TABLE> <DIV CLASS="bgc" ALIGN="center"> <TABLE WIDTH="65%" ALIGN="CENTER" BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TR> <TD WIDTH="27%" ALIGN="CENTER"> <DIV CLASS="next" ID="pre"></DIV></TD> <TD ALIGN="CENTER" WIDTH="50%"> <DIV ALIGN="CENTER" CLASS="viwe" ID="view"></DIV></TD> <TD WIDTH="23%" ALIGN="CENTER"> <DIV ID="next" CLASS="next"></DIV></TD> </TR> </TABLE> </DIV> </DIV><INPUT TYPE="hidden" NAME="products_id" ID="popup_proid" VALUE=""><INPUT TYPE="hidden" NAME="cart_quantity" VALUE="1"></FORM></DIV></TD> </TR> </TABLE> </DIV>');

var myWidth = 0, myHeight = 0;
function bhw() 
{

if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }

var h = window.pageYOffset ||
document.body.scrollTop ||
document.documentElement.scrollTop;
var browserName=navigator.appName; 

var imagedivheight=myHeight-93;
var test = myWidth*24/100;
var divwidth = myWidth-test;
var widthformizilla = myWidth-538;
var mozillawidth = widthformizilla-divwidth;
var iewidth = myWidth-516;

var mozillawidth1 = mozillawidth/2;
var iewidth1 = iewidth/2;

var mtop = h+7;
var aboveheight = myHeight-584;
var aboveheight1 = aboveheight/2+h;

var tablew = myWidth-22;

var intElemScrollHeight = document.getElementsByTagName('body')[0].scrollHeight;
var newh = intElemScrollHeight;

document.getElementById('message2').style.width="100%";
document.getElementById('message2').style.height=newh+"px";
document.getElementById('tableheight').style.width=tablew+"px";
document.getElementById('divheight').style.height=h+"px";

document.getElementById('tableheight').style.marginTop="0px";
document.getElementById('tableheight').style.height=myHeight+"px";

}




function blowup_show()
{
document.getElementById('message2').className="blowupshow";
bhw();
}




function blowup_off()
{
document.getElementById('message2').className="doff";
document.getElementById('loadimg').className="don";
document.getElementById('imagediv').className="doff";
}


var path = '';
var imgid = "0";
var queryrfq = '';
function imageset(id)
{
document.getElementById('loadimg').className="don";
document.getElementById('imagediv').className="doff";

	imgid = id;

	var pic = document.getElementById(imgid);
	productName =pic.alt;
	productName = unescape(productName);
	if(productName.length > 60)
        {
		var c = productName.substring(0,60);
		c = c + "...";
		productName = c;
        }



var mysize='size'+id;
var myweight='weight'+id;
var myprice='price'+id;
var mybigdesc='bigdesc'+id;
var myimagebig='imagebig'+id;


var mydelivery_note1='delivery_note1_'+id;
var mydelivery_note2='delivery_note2_'+id;
var mydelivery_note3='delivery_note3_'+id;


var hisize = document.getElementById(mysize).value;
var hiweight = document.getElementById(myweight).value;
var hiprice = document.getElementById(myprice).value;
var hibigdesc = document.getElementById(mybigdesc).value;
var hiimagebig = document.getElementById(myimagebig).value;


var hidelivery_note1 = document.getElementById(mydelivery_note1).value;
var hidelivery_note2 = document.getElementById(mydelivery_note2).value;
var hidelivery_note3 = document.getElementById(mydelivery_note3).value;



var path=hiimagebig;
document.getElementById('imagediv').innerHTML='<img src="'+path+'" alt="'+productName+'" onload="loadimg()" id="bigimg">'; 
// document.getElementById('qry').href=queryrfq;
document.getElementById('prname').innerHTML=productName;


document.getElementById('desc').innerHTML=hibigdesc;

if(hisize)
{
	document.getElementById('size').innerHTML='<DIV CLASS="txt-n"><B>Size</B> : '+hisize+'</DIV>';
}
if(hiweight)
{
	document.getElementById('weight').innerHTML='<DIV CLASS="txt-n"><B>Weight</B> : '+hiweight+'</DIV>';
}
document.getElementById('price').innerHTML='<B>Price</B> : '+hiprice;


if(hidelivery_note1)
{
	document.getElementById('note1').innerHTML='&#149; '+hidelivery_note1;
}
if(hidelivery_note2)
{
	document.getElementById('note2').innerHTML='&#149; '+hidelivery_note2;
}
if(hidelivery_note3)
{
	document.getElementById('note3').innerHTML='&#149; '+hidelivery_note3;
}

document.getElementById('popup_proid').value=id;

var allid = document.getElementById('allproducts_id').value;

var idarray = allid.split(",");
var array_length = idarray.length;
var k = '';
for (var i=0; i < array_length; i++) 
{
	if (idarray[i] == id)
	{
		k = i;
	}
}
if(k < array_length-1)
{
var l = k+1;
var h = idarray[l];
document.getElementById('next').innerHTML='<A HREF="javascript:imageset('+h+'); blowup_show()" TITLE="Use -> arrow key to view next product"><U>Next</U> <IMG SRC="gifs/next-icon.gif" border="0" ALIGN="ABSMIDDLE" WIDTH="31" HEIGHT="31"></A>';
}
else
{
document.getElementById('next').innerHTML='';
}

if(k > 0)
{
var l = k-1;
var h = idarray[l];
document.getElementById('pre').innerHTML='<A HREF="javascript:imageset('+h+'); blowup_show()" TITLE="Use <- arrow key to view previous product"><IMG SRC="gifs/previous-icon.gif" border="0" ALIGN="ABSMIDDLE" WIDTH="31" HEIGHT="31"> <U>Previous</U></A>';
}
else
{
document.getElementById('pre').innerHTML='';
}


var cur_pro = k+1;
document.getElementById('view').innerHTML='You are Viewing <B>'+cur_pro+'</B> of <B>'+array_length+' Products</B>';


}

function nextimg()
{
	if(imgid < dataref.length)
	{
	imgid++;
	}

	if(imgid < dataref.length)
	{
		var newImg = imgid;
		document.getElementById('next').style.display='block';
		document.getElementById('pre').style.display='block';	
	}
	else
	{
		var newImg = imgid;
		document.getElementById('next').style.display='none';
		document.getElementById('pre').style.display='block';
	}
	
	set_big_img_path(newImg);
	

	
	if (document.getElementById(newImg))
	{
		var pic = document.getElementById(newImg);
		productName =pic.alt;
		productName = unescape(productName);
		if(productName.length > 40)
        	{
			var c = productName.substring(0,40);
			c = c + "...";
			productName = c;
        	}


document.getElementById('imagediv').innerHTML='<img src="'+path+'" alt="'+productName+'" onload="loadimg()">'; 
document.getElementById('qry').href=queryrfq;
document.getElementById('prname').innerHTML=productName;
	}
	else
	{
		var newImg = --imgid;
	}



}

function previousimg()
{
if (imgid  > 1)
{
imgid--;
}


	if (imgid <= 1)
	{
		var newImg = imgid;
		document.getElementById('pre').style.display='none';
		document.getElementById('next').style.display='block';
	}
	else
	{
		var newImg = imgid;
		document.getElementById('pre').style.display='block';
		document.getElementById('next').style.display='block';	
	}
	
	set_big_img_path(newImg);
	

	
	var pic = document.getElementById(newImg);
	productName = pic.alt;
	productName = unescape(productName);
	if(productName.length > 40)
        {
		var c = productName.substring(0,40);
		c = c + "...";
		productName = c;
        }
	document.getElementById('imagediv').innerHTML='<img src="'+path+'" onload="loadimg()">';
	document.getElementById('qry').href=queryrfq;
	document.getElementById('prname').innerHTML=productName;
}


function set_big_img_path(imgid)
{
	document.getElementById('loadimg').className="don";
	document.getElementById('imagediv').className="doff";

	var k = dataref.length-1;
	if(k >= 0)
	{
		var i = imgid-1;
		path = eval("dataref["+i+"].img_path");

		queryrfq = eval("dataref["+i+"].queryrfq");
	}
}


function keyDown(e)
{var n = (window.Event) ? e.which : e.keyCode;

if(n==9 && document.getElementById('message2').className=="don")
	{
return false;
	}


else if(n==32 && document.getElementById('message2').className=="don")
	{
return false;
	}


else if(n==27 && document.getElementById('message2').className=="don")
	{
blowup_off();
	}

if((n==37 && document.getElementById('message2').className=="don") || (n==38 && document.getElementById('message2').className=="don"))
	{


if (imgid == 1)
{
return false;
}

previousimg();
}

else if((n==39 && document.getElementById('message2').className=="don") || (n==40 && document.getElementById('message2').className=="don"))
{
if (imgid == dataref.length)
{
return false;
}
nextimg();
return false;
}
}


function loadimg()
{
document.getElementById('loadimg').className="doff";
document.getElementById('imagediv').className="don";
}


function chrom()
{

if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }


var nAgt = navigator.userAgent;
var patt = /Chrome/;


if(document.getElementById('r1') && patt.test(nAgt))
{
if (myWidth >= 1250)
{
document.getElementById('r1').style.marginLeft="65px";
document.getElementById('r2').style.marginLeft="65px";
document.getElementById('r3').style.marginLeft="65px";
document.getElementById('r4').style.marginLeft="65px";
}

if (myWidth >= 1128  && myWidth < 1250)
{
document.getElementById('r1').style.marginLeft="55px";
document.getElementById('r2').style.marginLeft="55px";
document.getElementById('r3').style.marginLeft="55px";
document.getElementById('r4').style.marginLeft="55px";
}


if (myWidth >= 1000 && myWidth < 1128)
{
document.getElementById('r1').style.marginLeft="35px";
document.getElementById('r2').style.marginLeft="35px";
document.getElementById('r3').style.marginLeft="35px";
document.getElementById('r4').style.marginLeft="35px";
}


if (myWidth >= 800 && myWidth < 1000)
{
document.getElementById('r1').style.marginLeft="20px";
document.getElementById('r2').style.marginLeft="20px";
document.getElementById('r3').style.marginLeft="20px";
document.getElementById('r4').style.marginLeft="20px";
}

}
}



function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
	  obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
	  obj["e"+type+fn] = fn; 
	  obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
	  obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 

}

addEvent(window, 'load', chrom);
addEvent(window, 'resize', chrom);
