<!--
//Create a boolean variable to check for a valid Internet Explorer instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer.");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
//alert ("You are not using Microsoft Internet Explorer");
}

function makerequest(serverPage, objID) {
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

//hide(document.formcateList.currentId.value);
obj.innerHTML = xmlhttp.responseText;
document.formcateList.currentId.value = objID;
//alert(document.formcateList.currentId.value);

if (document.getElementById(objID).style.display == 'block')
{
hide(document.formcateList.currentId.value);
} else {
document.getElementById(objID).style.display = 'block';
}
//alert();
}
}
xmlhttp.send(null);
}
//-->

//============================20sept=============================================
function showoverlibcd_result(imgGroup,imgRank,imgCode) {
//alert(imgGroup);
//alert(imgRank);
//alert(imgCode);
    if (imgGroup != '') {
        var image_desc_html = '<div class="overlib_cdpreview">' + imgGroup + '</div>';
    }

    if (imgRank != '') {
        // var suppliername2 = suppliername.charAt(0).toUpperCase() + suppliername.substr(1);
        var image_supp_html = '<div class="overlib_supplierinfo">&copy; ImagesBazaar.com</div>';
    }
//	varImg = 'http://www.imagesbazaar.com/ibsiteadmin/thumb/'+ imgRank + '-' + imgCode + '.jpg';
 varImg = '/thumb/'+ imgRank + '-' + imgCode + '.jpg';
 //alert(varImg);
 var newImg = new Image();
 newImg.src = varImg;
 var height = newImg.height;
 var width = newImg.width;

//	alert(height);
//	alert(width);

  //alert (varImgPath);
    if (width == 170){
	varImgPath = "<img src='watermarked_thumbnailLargeH.aspx?img="+ imgGroup + "/"  + imgRank + "-" + imgCode + ".jpg'>";
	return overlib(varImgPath + image_supp_html,WIDTH,10,HAUTO,VAUTO,BGCOLOR,'#888888',FGCOLOR,'#888888');
	}else if(width == 113){
	varImgPath = "<img src='watermarked_thumbnailLargeV.aspx?img="+ imgGroup + "/"  + imgRank + "-" + imgCode + ".jpg'>";
	return overlib(varImgPath + image_supp_html,WIDTH,10,HAUTO,VAUTO,BGCOLOR,'#888888',FGCOLOR,'#888888');
   }
}

function remember_preview(view) {

    var futdate = new Date();
    var expdate = futdate.getTime();
    expdate += 60 * 24 * 3600 * 1000 // expires in 60 days (milliseconds)
    futdate.setTime(expdate);

    setCookie('cdview', view, futdate, '/');
    document.location.href = document.location.href;
}



//============================20sept=============================================


function chkval()
{
if(isNaN(document.getElementById("pno").value)||document.getElementById("pno").value=='')
{
alert('Enter Numeric Value in Pages');
document.forms[1].pno.focus();
return 0;
}

if(getQueryVariable('refid') != undefined)
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno").value + '&imgperpage=' + document.getElementById("pp2").value + '&searchid=' + getQueryVariable('searchid')+ '&refid=' + getQueryVariable('refid')+ '&searchcate=' + getQueryVariable('searchcate')
}
else
if(getQueryVariable('searchid') != undefined)
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno").value + '&imgperpage=' + document.getElementById("pp").value + '&searchid=' + getQueryVariable('searchid')}
else
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno").value + '&imgperpage=' + document.getElementById("pp").value 
}
}

function chkval1()
{
//alert(document.getElementById("pp").value);
document.getElementById("h1").value=document.getElementById("pp").value
if(getQueryVariable('refid') != undefined)
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp").value + '&searchid=' + getQueryVariable('searchid')+ '&refid=' + getQueryVariable('refid')+ '&searchcate=' + getQueryVariable('searchcate')
}
else
if(getQueryVariable('searchid') != undefined)
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp").value + '&searchid=' + getQueryVariable('searchid')
}
else
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp").value 
}

}
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
 
}

function chkval_d()
{
if(isNaN(document.getElementById("pno2").value)||document.getElementById("pno2").value=='')
{
alert('Enter Numeric Value in Pages');
document.getElementById("pno2").focus();
return 0;
}

if(getQueryVariable('refid') != undefined)
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno2").value + '&imgperpage=' + document.getElementById("pp2").value + '&searchid=' + getQueryVariable('searchid')+ '&refid=' + getQueryVariable('refid')+ '&searchcate=' + getQueryVariable('searchcate')
}
else
if(getQueryVariable('searchid') != undefined)
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno2").value + '&imgperpage=' + document.getElementById("pp").value + '&searchid=' + getQueryVariable('searchid')}
else
{
window.location="advancesearchresult1.aspx?Page=" + document.getElementById("pno2").value + '&imgperpage=' + document.getElementById("pp").value 
}
}
function chkval1_d()
{
document.getElementById("h1").value=document.getElementById("pp2").value
if(getQueryVariable('refid') != undefined)
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp2").value + '&searchid=' + getQueryVariable('searchid')+ '&refid=' + getQueryVariable('refid')+ '&searchcate=' + getQueryVariable('searchcate')
}
else
if(getQueryVariable('searchid') != undefined)
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp2").value + '&searchid=' + getQueryVariable('searchid')
}
else
{
window.location="advancesearchresult1.aspx?imgperpage=" + document.getElementById("pp2").value 
}

}
//==========================================================================================




function Getbuy(CtrlName)
{   



  window.location='loginCheck.aspx?id=' + CtrlName;   
  
}
 
function GetUrl(img)
{   
window.open("preview.aspx?id=" + img, '', 'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=800,height=600,left=100, top=100');
  
} 

//==================================================================================================



function show(ele) {
	var srcElement = document.getElementById(ele);
	if(srcElement != null) {
   if(srcElement.style.display == "none") {
   srcElement.style.display= 'block';
   }
   }
	 }
	 
	 function showHideAdvTab(ele)
	 {
		//alert(ele); 
		var srcElement = document.getElementById(ele);
		if (document.formcateList.chkcheck.checked == true)
		{
			//alert("TRUE");
			srcElement.style.visibility= 'hidden';
		}else{
			//alert("FALSE");
			srcElement.style.visibility= 'visible';
		}//end if
		 
	 }//showhideAdvTab
	 
	 
	 	 function showHideAdvDiv(ele)
	 {
		//alert(ele); 
		var srcElement = document.getElementById(ele);
		if (document.formcateList.chkcheck.checked == true)
		{
			//alert("TRUE");
			document.getElementById("Header1_txtid").value='';
			srcElement.style.display= 'none';
		}else{
			//alert("FALSE");
			srcElement.style.display= 'block';
		}//end if
		 
	 }//showhideAdvDiv

	 
function showLayers(ele) {
	
	var srcElement = document.getElementById(ele);
	document.getElementById("txtid").value = document.getElementById("txtid2").value ;
	if(srcElement != null) {
   //alert(srcElement.style.display);
   //alert(srcElement.style.visibility);
      if(srcElement.style.visibility == "hidden") {
   srcElement.style.visibility= 'visible';
   }
   }
   	document.getElementById("txtid").focus();
	 }
	 
function showLayersH2(ele) {
	var srcElement = document.getElementById(ele);
	var srcElement1 = document.getElementById('advTab');
//	var srcElement2 = document.getElementById('chkcheck').checked;
	//alert(srcElement2);
	document.getElementById("txtid").value = document.getElementById("txtid2").value ;
	if(srcElement != null) {
     if(srcElement.style.visibility == "hidden") {
   srcElement.style.visibility= 'visible';
   srcElement1.style.visibility= 'visible'}
   document.getElementById('chkcheck').checked = false;
   }
      	document.getElementById("txtid").focus();
	 }	 
	 
	 function hideLayers(ele) {
	
	var srcElement = document.getElementById(ele);
	document.getElementById("txtid2").value = document.getElementById("txtid").value ;
	if(srcElement != null) {
   //alert(srcElement.style.display);
  // alert(srcElement.style.visibility);
      if(srcElement.style.visibility == "visible") {
   srcElement.style.visibility= 'hidden';
   }
   }
	 }
	 
	 function hideLayersH2(ele) {
	
	var srcElement = document.getElementById(ele);
	var srcElement1 = document.getElementById('advTab');
	document.getElementById("txtid2").value = document.getElementById("txtid").value ;
	if(srcElement != null) {
      if(srcElement.style.visibility == "visible") {
   srcElement.style.visibility= 'hidden';
   }
   }srcElement1.style.visibility= 'hidden';
	 }
	 
 function hide(ele) {
    //alert (ele);
	var srcElement = document.getElementById(ele);
	if(srcElement != null) {
   if(srcElement.style.display == "block") {
   srcElement.style.display= 'none';
   }
   }
	 }
//================================================================================================

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}


function stopval()
{
document.frmAdvSearchform.txtsearch1.value=stopKeyword(document.frmAdvSearchform.txtsearch1.value)
}


function changeval(argKey)
{
//alert(argKey);
var orientation = ""

document.forms[0].hi1.value=document.forms[0].txtsearch1.value;
//alert(document.forms[0].hi1.value);
//alert(document.frmAdvSearchform.chkOrientation.length);
for(var i=0; i < document.frmAdvSearchform.chkOrientation.length; i++)
 {

   if(document.frmAdvSearchform.chkOrientation[i].checked)
   orientation +=document.frmAdvSearchform.chkOrientation[i].value + " "
     	
 }

  
  if (document.frmAdvSearchform.chkOrientation[0].checked && document.frmAdvSearchform.chkOrientation[1].checked)
  {
  //alert(orientation);
   orientation="";
   }
   
  if (argKey)
    {
	  document.getElementById("txtsearch").value=stopKeyword(TrimString(document.getElementById("txtsearch1").value));
	}
  else
    {
	  var keywords;
	  keywords=TrimString(stopKeyword(document.getElementById("txtsearch1").value)) + " " + TrimString(orientation) + " " + TrimString(document.getElementById("ddlNoPeople").value) + " " +  TrimString(document.getElementById("select1").value);
	  document.getElementById("txtsearch").value= keywords.replace("  "," ")
	
	}



document.forms[0].chid.value = '';
//if(document.forms[0].searchwithin.checked==true)
// {
//	document.forms[0].txtsearch.value='<%'=session("txtsearch")%>' + " " + stopKeyword(document.forms[0].txtsearch1.value);
//	document.forms[0].hi1.value='<%'=session("searcon")%>' + " " + document.forms[0].txtsearch1.value
//	document.forms[0].hflag.value=1;
// }
//
//else
//	document.forms[0].hflag.value=0;
	//alert(document.forms[0].txtsearch.value);
	document.frmAdvSearchform.submit();
}
function changeval2()
{
window.location="advancesearchresult.aspx?imgperpage=24&idsearch=" + document.forms[0].txtsearchid2.value;
}
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}



function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function showSearchPnl(div1,arg)
{

if (arg)
{
 if(document.getElementById(div1).style.display == "block")
  {   
  //alert(document.getElementById(div1).style.display);
    document.getElementById(div1).style.display = "none";
  }
 
 }
 else
    document.getElementById(div1).style.display = "block";
}

//function showSearchPnlClick(div1,div2,arg,arg2)
//{
//alert(arg2);
//document.frmAdvSearchform.txtsearchid1.value = arg;
//document.formsearch.txtsearch1.value = arg;
//
//	 if(document.getElementById(div1).style.display == "block")
//  {   
//    document.getElementById(div1).style.display = "none";
//  	document.getElementById(div2).style.display = "block";
//  }
//  
//}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function Getbuy(CtrlName)
{   
  window.location='loginCheck.aspx?id=' + CtrlName;   
}
function GetUrl(img)
{ 
window.open("preview.aspx?id=" + img, '', 'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=800,height=600,left=100, top=100');
} 