

function openPopup(pu,sn,iw,ih,il,it,im,i2,ito,ist,ir,ilo) {
	var a1;
	a1="width="+iw+",height="+ih;
	a1+=",left="+ il +",top="+ it +",directories=0,hotkeys=1";
	a1+=",menubar="+im +",scrollbars="+i2+",toolbar="+ito+",status="+ist;
	a1+=",resizable="+ir+",location="+ilo;
	window.open(pu,sn,a1);
	return;
}


function PopUpSize(pu,sn,iw,ih) {
	var a1;
	a1="width="+iw+",height="+ih;
	a1+=",left=100,top=100,directories=0,hotkeys=1,location=0,menubar=0";
	a1+=",resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0";
	window.open(pu,sn,a1);
	return;
}

function PopUpScrollBarSize(pu,sn,iw,ih) {
	var a1;
	a1="width="+iw+",height="+ih;
	a1+=",left=100,top=100,directories=0,hotkeys=1,location=0,menubar=0";
	a1+=",resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0";
	window.open(pu, sn, a1);
	return;
}


if (document.images) { 
img1on = new Image();
img1on.src = "http://www.devilcards.com/mediastore/images/logo-devil_150.gif"; 
img1off = new Image(); 
img1off.src = "http://www.devilcards.com/mediastore/images/logo-devil2_150.gif";  
}

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");}
}

function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");}
}
 

//The following controls all div expanders
//Expands all divs with class=toggle, or when class=toggle2 while autocollapsing is off
function expandAll(itemname, state) {
	tmp = document.getElementsByTagName('div');
	for (i=0;i<tmp.length;i++) {
		if ((tmp[i].className == itemname)||(tmp[i].className == 'toggle2')) tmp[i].style.display = state;
	}
}

//Collapses all divs with class=toggle, or when class=toggle2 while autocollapsing is off
function collapseAll(itemname, state) {
	tmp = document.getElementsByTagName('div');   
	for (i=0;i<tmp.length;i++) {
		if ((tmp[i].className == itemname)||(tmp[i].className == 'toggle2')) tmp[i].style.display = state;
	}
}

//Collapses all divs with class=toggle except the one initially clicked (not used when auto-collapsing is off)
function toggleOthers(itemname, state) {
   tmp = document.getElementsByTagName('div');   
   for (i=0;i<tmp.length;i++) {
	if (tmp[i].className == itemname) tmp[i].style.display = state;
   }
}

//Expands div clicked
function toggle(idname) {
	document.getElementById(idname).style.display = (document.getElementById(idname).style.display == 'none') ? 'block' : 'none';	
}

//Collapses div clicked
function expandContent(idname) {
	origStatus = (document.getElementById(idname).style.display == 'block') ? 'block' : 'none';
	divID = document.getElementById(idname)
	if (divID.className == 'toggle') {
	      toggleOthers('toggle','none');	      
	   	if (origStatus=='none') { toggle(idname); }
	}
   	else if (divID.className == 'toggle2') {   		
   		if (origStatus=='none') { toggle(idname); }
   		if (origStatus=='block') { divID.style.display = "none"; }
   	}
}

//Turn off auto-collapsing
function collapseOff(newClass) {
   tmp = document.getElementsByTagName('div');
   spn = document.getElementsByTagName('span');
   for (i=0;i<tmp.length;i++) {
      if (tmp[i].className == 'toggle') {
      tmp[i].className = newClass;
      }
   }
   for (j=0;j<spn.length;j++) {
      if (spn[j].className == 'autoCollapseOff') {
         spn[j].style.display = "none";
      }
      if (spn[j].className == 'autoCollapseOn') {
         spn[j].style.display = "inline";
      }
   }
}

//Turn on auto-collapsing
function collapseOn(newClass) {
   tmp = document.getElementsByTagName('div');
   spn = document.getElementsByTagName('span');
   for (i=0;i<tmp.length;i++) {
      if (tmp[i].className == 'toggle2') {
      tmp[i].className = newClass;
      }
   }
   for (j=0;j<spn.length;j++) {
      if (spn[j].className == 'autoCollapseOff') {
         spn[j].style.display = "inline";
      }
      if (spn[j].className == 'autoCollapseOn') {
         spn[j].style.display = "none";
      }
   }
}


// display appropriate form
function display_form(elname) {

	collapseAll('toggle', 'none', 'null')
	
	if(elname.value > 0) {
	
		if(elname.value == 2) {
			expandContent('pafa')
			//expandContent('pafa2')
		} else {	

			expandContent('full_addr')
		}
	}
}
function getObj(name) {
obj = document.getElementById(name);
return obj;
}

function tickBox(tick_id) {
			tickObj = getObj("tick_"+tick_id);
			adObj = getObj("ad_ticked["+tick_id+"]");
	if (tickObj.src.indexOf("tick_box.gif")<0 ) {
			tickObj.src = unticked_box.src;
			adObj.value = "no";
	}
	else {
			tickObj.src = ticked_box.src;
			adObj.value = "yes";							
	}
}

function dropDown(drop_downID, action) {
	dropObj = getObj(drop_downID);
	if (dropObj) {
		if (action == "close") {
			dropObj.style.display = "none";
		}
		else {
			dropObj.style.display = "block";		
		}
	}
}
