var ns  = (document.layers)? true:false; 
var ie4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true:false;
var ie5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true:false;
var ie6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true:false;
var ie = ie4 || ie5 || ie6;
var dom = (document.getElementById) ? true:false;
var splashWin = null;


function zwindow(source,name,width,height,nHow)
{
  /*
  nHow == 0 - centered;
  nHow == 1 - up left
  */
  var screenWidth,screenHeight,splashWin; 
  screenWidth  = screen.availWidth;
  screenHeight = screen.availHeight;  
  if(nHow == 0)
  {
    if(ie||dom) { splashWin = window.open(source,name, "width="+width+",height="+height+",left="+(screenWidth-width)/2+",top="+(screenHeight-height)/2+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
    if(ns) { splashWin = window.open(source,name, "width="+width+",height="+height+",screenX="+(screenWidth-width)/2+",screenY="+(screenHeight-height)/2+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
  }
  if(nHow == 1)
  {
    if(ie||dom) { splashWin = window.open(source,name, "width="+width+",height="+height+",left=7,top=18,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
    if(ns) { splashWin = window.open(source,name, "width="+width+",height="+height+",screenX=0,screenY=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0" ); }
  }
  
}


function init(){
   pushimages();

}

function pushimages() {

      for (var i=0; i<document.images.length; i++) {
        if (!document.images[i].complete) {
            document.images[i].src = document.images[i].src;
        }
      }

}


function loadmorefeatured(chunk){
	   location.replace("index.php?&chunk="+chunk);

}



function previewlayout(id){
		 window.open("http://layouts4myspace.info/layout_preview_by_id.php?id="+id, "mylayout");

}



function showloadcode(idloadcode){
	document.getElementById(idloadcode).style.display="block";
	//alert("in testing...");

}

function hideloadcode(idloadcode){
	document.getElementById(idloadcode).style.display="none";

}




function mylogin(id){
  if ( eval("document.form"+id+".myname"+id+".value") != ''  &&  eval("document.form"+id+".mypass"+id+".value") != '')
  {
	    document.getElementById("myname").value     = eval("document.form"+id+".myname"+id+".value");
        document.getElementById("mypass").value     = eval("document.form"+id+".mypass"+id+".value");
        document.getElementById("xid").value        = eval("document.form"+id+".xid"+id+".value");
        document.getElementById("xcat").value       = eval("document.form"+id+".xcat"+id+".value");
        document.getElementById("loadlayout").value = eval("document.form"+id+".loadlayout"+id+".value");
		//--initializare
		eval("document.form"+id+".myname"+id+".value=''");
		eval("document.form"+id+".mypass"+id+".value=''");
		//eval("document.form"+id+".xid"+id+".value=0");
		//eval("document.form"+id+".xcat"+id+".value=0");
		//eval("document.form"+id+".loadlayout"+id+".value=0");

		//--submit

		document.colectform.submit();
		//document.getElementById('colectform').submit();
  }

  else{
	  alert('please enter data for both fields name and password !');
  }		 
} 



function myregister(){
	document.location.href= "register.php";
}



function doRating(id,rate,ratetarget){

if( id != -1){

	if(rate == -1){ alert("do select a rank please..."); }
	else{		
		work = ratetarget+".document.location.href = 'http://www.layouts4myspace.info/_markrate.php?id="+id+"&rate="+rate+"'";
		eval(work);		
	}
}
else { alert("wrong layout ID !");}
}

