function addtolightbox(a)
{
	if (document.fr1.customerid.value<=0)
	{
		alert("Please Login first to gain access to:\r\n\r\n *  Customizable and savable lightboxes\r\n *  Large previews with image details\r\n *  Unwatermarked comps (for ad placement / mockup purposes ONLY)\r\n *  Instant online pricing calculator or special license request\r\n *  60Mb+ high-res files available immediately after purchase\r\n *  All major credit cards accepted or apply for a company account");
		document.fr1.action="/logi.php";
		document.fr1.submit();
		return;
	}
	$("#lightbox").load("showlightbox.php?todo=addtolightbox&id="+a);
	return;
}

function deletelightboxdirect(a)
{
	if (confirm("Are you sure you want to delete this image from your Lightbox?"))
	{
		$("#lightbox").load("showlightbox.php?todo=deletelightboxdetail&id="+a);
		return;
	}
}

function changedlightboxdirect()
{
	$("#lightbox").load("showlightbox.php?mylid="+document.fr1show.mylid.value);
	return;
}

function priceme1(a)
{
	document.fr1.todo.value="";
	document.fr1.action="priceme2.php";
	document.fr1.imageno.value=a;
	document.fr1.submit();
}

function pricemesb(a,b)
{
	if (b=="RF")
	{
		return priceme1(a);
	}
	else
	{
		return addcartp(a);
	}
}


function addcartp(a)
{
	if (document.fr1.customerid.value<=0)
	{
		alert("Please Login first to gain access to:\r\n\r\n *  Customizable and savable lightboxes\r\n *  Large previews with image details\r\n *  Unwatermarked comps (for ad placement / mockup purposes ONLY)\r\n *  Instant online pricing calculator or special license request\r\n *  60Mb+ high-res files available immediately after purchase\r\n *  All major credit cards accepted or apply for a company account");
		document.fr1.imageno.value=a;
		document.fr1.action="/priceme.php";
		document.fr1.submit();
		return;
	}
	document.fr1.action="/priceme.php";
	document.fr1.imageno.value=a;
	document.fr1.submit();
}

function mylight(a)
{
	document.fr1.mylid.value=a;
	mylightbox();
}
function mylight1(a)
{
	document.fr1.mylid.value=a;
}

function hidemedirect(a)
{

	if (a==0)
	{
		$("#mainbody").height($(window).height()-115-18);
		$("#lightbox").height(115);
		$("#lightbox").load("showlightbox.php?hideme="+a);
	}
	else
	{
		$("#mainbody").height($(window).height()-30-18);
		$("#lightbox").height(30);
		$("#lightbox").load("showlightbox.php?hideme="+a);
	}

}

function createlightboxdirect()
{
	var newname=prompt("Enter name of new Lightbox to create","");
	if (newname!=null)
	if (newname!=""  && newname!="null" && newname!="undefined")
	{
		$("#lightbox").load("showlightbox.php?todo=addnew&imageno="+escape(newname));
	}
}

function keywordsearch()
{
	document.forms[0].target="_top";
	document.fr1.action="/keysearch.php";
	document.fr1.submit();
}


function asearch()
{
	document.forms[0].target="_top";
	document.fr1.action="/advsearch.php";
	document.fr1.submit();
}
function previmage1(a)
{
	b=0;
	eval("bc"+a+"--;");
	eval("b=bc"+a+";");
	eval("d=bd"+a+";");
	if (b<0)
	{
		b=d-1;
		eval("bc"+a+"=b;");
		eval("c=b"+a+"[b];");
		eval("document.i"+a+".src=c;");
	}
	else
	{
		eval("c=b"+a+"[b];");
//		alert(c);
		eval("document.i"+a+".src=c;");
	}
	eval("document.pr"+a+".src=\"/num.php?numid="+(b+1)+"\";");
	eval("d=bk"+a+"[b];");
	eval("document.prg"+a+".src=\"/num1.php?numid="+d+"\";");
	eval("d=is"+a+"[b];");
	eval("bs"+a+"=d;");
}
function nextimage(a,b)
{
	$('#adata'+b).load("nextimage.php?id="+a+"&oldid="+b);
}
function previmage(a,b)
{
	$('#adata'+b).load("previmage.php?id="+a+"&oldid="+b);
}
function nextimage1(a)
{
	b=0;
	eval("bc"+a+"++;");
	eval("b=bc"+a+";");
	eval("d=bd"+a+";");
	if (b==d)
	{
		b=0;
		eval("bc"+a+"=0;");
		eval("c=b"+a+"[b];");
		eval("document.i"+a+".src=c;");
	}
	else
	{
		eval("c=b"+a+"[b];");
		eval("document.i"+a+".src=c;");
	}
	eval("document.pr"+a+".src=\"/num.php?numid="+(b+1)+"\";");
	eval("d=bk"+a+"[b];");
	eval("document.prg"+a+".src=\"/num1.php?numid="+d+"\";");
	eval("d=is"+a+"[b];");
	eval("bs"+a+"=d;");
}

function showpic1(a)
{
	if (document.fr1.customerid.value<=0)
	{
		alert("Please login first");
		document.fr1.action="/logi.php";
		document.fr1.submit();
		return;
	}
	document.fr1.action="/searchresult.php";
	eval("a=bs"+a+";");
	document.fr1.imageno.value=a;
	document.fr1.submit();
}
function submitmes()
{
	document.searchmes1.submit();
}
function submitmewithin()
{
	document.searchmes1.olds.value=1;
	document.searchmes1.submit();
}

                  function smt(a)
                  {
                  	k=0;
                  	if (document.searchmes1.royaltype1[0].checked) k=k+1;
                  	if (document.searchmes1.royaltype1[1].checked) k=k+2;
                  	if (k==3) k=0;
                  	document.searchmes1.royaltype.value=k;
                  }



$().ready(function() {
	$("#suggest4").autocomplete('autocomplete1.php', {
		width: 300,
		multiple: true,
		matchContains: true
	});

	$("#clear").click(function() {
		$(":input").unautocomplete();
	});
});


