function GoVisitNode(node_id) {
	window.open('index.php?act=allstores&sub=go&p=1&id='+node_id,'img','width=610,height=510,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=no');
}

function GoOpenNode(node_id) {
	window.open('index.php?act=allstores&sub=info&p=1&id='+node_id,'img','width=610,height=510,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=no');	
}

function StarChecker() {

	if (POST_SUBMIT != 1) return;

	for (i=0;i<document.forms.length;i++) {

		for (y=0;y<document.forms[i].elements.length;y++) {

			curelem = document.forms[i].elements[y];

			if (curelem.className == 'starfield_char') {

				if ((curelem.value.length < 2) || (curelem.value == '-')) curelem.className = 'starfield_notcorrect';

			} else

			if (curelem.className == 'starfield_int') {

				if (parseInt(curelem.value) < 1) curelem.className = 'starfield_notcorrect';

			}

		}

	}

}

function SetJSField(Tid,Tvalue) {

	tF = document.getElementById(Tid);

	if ((tF.type == 'radio') || (tF.type == 'checkbox')) {

		if (Tvalue == 1) tF.checked = true; else tF.checked = false;

	} else {

		tF.value = (Tvalue);

	}

}

function FormatMoney(value) {
   result=""+Math.floor(value)+".";

   var cents=100*(value-Math.floor(value))+0.5;
   result += Math.floor(cents/10);
   result += Math.floor(cents%10);
   return result;
}

function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
	expire = new Date((new Date()).getTime() + hours * 3600000);
	expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}


function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }

	 return true					
}

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
	var x = Math.round(num * Math.pow(10,dec));
	
	if (x >= 0) n1=n2='';
	
	var y = (''+Math.abs(x)).split('');
	var z = y.length - dec;
	y.splice(z, 0, pnt);
	
	while (z > 3) {
		z-=3; 
		y.splice(z,0,thou);
	}
	
	var r = curr1+n1+y.join('')+n2+curr2;
		
	return r;
}

/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/
function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

function pWin(url,resizable){
	if (resizable == 1)
	window.open(url,'Tokashsilver','toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=320,top=10,left=10'); else
	window.open(url,'Tokashsilver','toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=no,width=400,height=320,top=150,left=150');
}


///index template
function Search() {
	if (document.search_form.q.value.length < 2) {
		alert('Enter at least 2 Characters');
		return;
	}
	document.search_form.submit();
}

	function AddToBookmarks(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
