/* $Id: scripts.js,v 1.11 2005/12/23 12:30:50 rupee Exp $ */
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];}
}

// popup stuff


var isIE;
if(document.all){isIE=true}

function pop(URL,h,w) {
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
        //for Netscape	
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "HEIGHT=" + h + ",WIDTH=" + w + ",scrollbars";
	newWin =  window.open(URL,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}

function backtoWin(url) {
    parent.window.opener.location = url ;
    parent.window.opener.focus();
}

function popup(URL,type) {
	if ("small" == type) {
		w = "375";
		h = "345";
	} else if ("small_long" == type) {
		w = "375";
		h = "450";	
		
	} else if ("large" == type) {
		w = "585";
		h = "400";	
	} else if ("large_long" == type) {
		w = "585";
		h = "600";
	}
	pop(URL,h,w);
}

var currentIndex = 0;
var currentIsSuper = false;
			
function update(url, index, isSuper, filename, bu, img_id) 
{
	currentIndex = index;
	currentIsSuper = isSuper;
	document['BigPic'].src=url;
		
	if (isSuper)
	{
		visibleState = "visible";
	} else 
	{
		visibleState = "hidden";
	}
	document.getElementById("filename").value = filename;
	document.getElementById("bu").value = bu;
	document.getElementById("bu_txt").innerHTML = bu;
	document.getElementById("img_id").value = img_id;
				
	return false;
}
function popProduct(h,w)
{
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
        //for Netscape	
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "height=" + h + ",width=" + w;
	id = document.getElementById("img_id").value;
	d = document.getElementById("dark").value;
	newWin =  window.open('?ch=222&d=' + d + '&id=' + id,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}


function popMaterial(h,w,id) {
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
        //for Netscape	
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "height=" + h + ",width=" + w + ",scrollbars,resizable";
	newWin =  window.open('?ch=223&id=' + id,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}

function popCountry(h,w,id) {
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
        //for Netscape	
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "height=" + h + ",width=" + w + ",scrollbars,resizable";
	newWin =  window.open('?ch=224&id=' + id,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}
function popImage(h,w,id)
{
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
        //for Netscape	
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "height=" + h + ",width=" + w;
	newWin =  window.open('../?ch=222&id=' + id,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}
