

var dimension="3x3" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
var imagepath="http://www.idealhome.co.in/pictures/Kitchen-linens/mitten/" 
var href_target="new" 
var popupsetting=[1, "width=650px, height=600px, scrollbars, resizable"]
//var descriptionprefix=[1, "HT "]
var descriptionprefix=[0]
var gsortorder="desc"

//var targetlinkdir="http://www.webcraftonline.com/largegallery/"
var targetlinkdir=""
/////No need to edit beyond here///////////////////

function sortbydate(a, b){ //Sort images function
if (gsortorder=="asc") //sort by file date: older to newer
return new Date(a[1])-new Date(b[1])
else if (gsortorder=="desc") //sort by file date: newer to older
return new Date(b[1])-new Date(a[1])
}

if (gsortorder=="asc" || gsortorder=="desc")
galleryarray.sort(sortbydate)

var totalslots=dimension.split("x")[0]*dimension.split("x")[1]

function buildimage(i){
var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'
tempcontainer+='<img src="'+imagepath+galleryarray[i][0]+'" title="'+galleryarray[i][0]+' ['+galleryarray[i][1]+']" />'
tempcontainer+='</a><br />'
tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : galleryarray[i][0].slice(0,galleryarray[i][0].indexOf("."))
return tempcontainer
}

function jumptopage(p){
var startpoint=(p-1)*totalslots
var y=1;
for (i=0; i<totalslots; i++){
document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
}
while(document.getElementById("navlink"+y)!=null){
document.getElementById("navlink"+y).className=""
y++
}
document.getElementById("navlink"+p).className="current"
}

var curimage=0
for (y=0; y<dimension.split("x")[1]; y++){
for (x=0; x<dimension.split("x")[0]; x++){
if (curimage<galleryarray.length)
document.write('<div id="slide'+curimage+'" class="slideshow">'+buildimage(curimage)+'</div>')
curimage++
}
document.write('<br style="clear: left" />')
}

function popuplinkfunc(imgsrc){
	myString = new String(imgsrc);
fred=myString.substr(myString.lastIndexOf("/"),myString.lastIndexOf("."));
ted=fred.slice(0,fred.indexOf("."))
if (popupsetting[0]==1){
	var popwin=open("", "popwin", popupsetting[1])
	  popwin.document.write("<p align='left'><b><font size='4' face='Tahoma'>Ideal Home Buying agency</font></b></p>");
 popwin.document.write("<hr>");
popwin.document.write("<tr><td ><img src="+imgsrc.href+"></td></tr>");
 popwin.document.write("<p><b><font size='2' face='Tahoma' color='#FF0000'>Enquiry</font></b></p>");
 popwin.document.write("<form id='form1' name='form1' method='post' action='mail1.php'>");
 popwin.document.write("<table width='538' border='0' height='318'>");
 popwin.document.write("<tr><td width='271' height='35'><font face='Tahoma' size='2'><strong>Product Code</strong></font></td>");
 popwin.document.write("<td width='251' height='35'>");
 popwin.document.write("<input type='text' name='fname' size='20' value="+ted+" />");
 popwin.document.write("</td></tr>");
 popwin.document.write("<tr><td width='271' height='35'>");
 popwin.document.write("<font size='2' face='Tahoma'><strong>Nature of business:</strong></font></td>");
 popwin.document.write("<td width='251' height='35'>");
 popwin.document.write("<select size='1' name='S1'>");
 popwin.document.write("<option>--Choose--</option>");
popwin.document.write("<option value='Individual Buyer'>Individual Buyer</option><option value='wholesaler'>Wholesaler</option>");
popwin.document.write("<option value='multiple store retailer'>Multiple store retailer</option>");
popwin.document.write("<option value='retailer'>Retailer</option>");
popwin.document.write("<option value='Other'>Other </option></select>");
popwin.document.write(" </td></tr><tr><td height='84'>");
popwin.document.write("<font face='Tahoma'><strong><font size='2'>specific requirements:</font>");
popwin.document.write("</strong></font></td>");
popwin.document.write("<td height='84'><textarea name='address' rows='5' cols='25'></textarea></td></tr>");
//popwin.document.write("<tr><td height='23'><font face='Tahoma'><strong><font size='2'>Estimated Quantity:</font></strong></font></td>");
//popwin.document.write("<td height='23'><input type='text' name='query' size='31' /></td></tr>");
//popwin.document.write("<tr><td height='23'><strong><font size='2' face='Tahoma' color='#FF0000'>YOUR CONTACT INFORMATION</font>");
//popwin.document.write("</strong></td>");
popwin.document.write("<td ></td></tr><tr>");
popwin.document.write("<td height='23'><font face='Tahoma'>");

popwin.document.write("<font size='2'>*</font><strong><font size='2'>Organisation/Company Name:</font></strong></font></td>");

popwin.document.write("<td height='23'><input type='text' name='cname' size='31' /></td></tr><tr>");

popwin.document.write("<td height='21'><font face='Tahoma'><font size='2'>*</font><strong><font size='2'>Email:</font>");

popwin.document.write("</strong></font></td>");

popwin.document.write("<td height='21'><input type='text' name='email' size='31' />");
popwin.document.write("</td> </tr><tr><td height='23'><b><font size='2' face='Tahoma'>Address</font></b></td>");

popwin.document.write("<td height='23'><input type='text' name='country' size='31' /></td>");

popwin.document.write("</tr><tr><td height='23'><b><font size='2' face='Tahoma'>Country</font></b></td>");

popwin.document.write("<td height='23'><input type='text' name='okr' size='31' /></td></tr>");

popwin.document.write("<tr><td colspan='2' height='27'><div align='center'>");

popwin.document.write("<input type='submit' name='Submit' value='Submit' />");

popwin.document.write("<input type='reset' name='Submit2' value='Reset' />");
popwin.document.write("</form>");
 	      popwin.document.write("</body></html>");
		  popwin.document.close();
  popwin.focus()
return false
}
else
return true
}

