function Toggle(item)
{
	obj=document.getElementById(item);
	visible=(obj.style.display!="none")
	key=document.getElementById("x" + item);
	if (visible)
	{
		obj.style.display="none";
	}
	else
	{
      obj.style.display="block";
   }
}
function Expand()
{
	divs=document.getElementsByTagName("DIV");
	for (i=0;i<divs.length;i++)
	{
		divs[i].style.display="block";
		key=document.getElementById("x" + divs[i].id);
   }
}
function Collapse()
{
   divs=document.getElementsByTagName("DIV");
	for (i=0;i<divs.length;i++)
	{
		divs[i].style.display="none";
		key=document.getElementById("x" + divs[i].id);
	}
}


//var affInterfaceOptions = '&pr_code=vU0oei35jR56r01bP274uN7lFx8jd1&cols=2&rows=4&shop=z2-green';
var affInterfaceOptions = 'cols=2&amp;rows=4&amp;sadult=0&amp;sp=30&amp;bgcolor=%23FFFFFF&amp;iw=430&amp;category=0&amp;pr_code=vU0oei35jR56r01bP274uN7lFx8jd1';

function IncludeAffInterface(options,file){
	if(!file) file = 'pr_interface';
	options = affInterfaceOptions + (options ? '&'+options : '');
	document.write('<SCRIPT type="text/javascript" language="JavaScript" src="http://www.templatehelp.com/codes/'+file+'.php?'+options+'"><'+'/SCRIPT>');
}

function Popup(url){
	window.open(
		url,
		'window',
		'width=600, height=600, resizable=yes, scrollbars=yes, location=no,  toolbar=no, menubar=no, status=no'
	);
}
// Hide "www.mytemplatestorage.com" from status bar
function HideStatus(){
	window.status = document.readyState!="complete" ?
		"Loading..." : window.defaultStatus;
}
document.onreadystatechange = HideStatus;


// Author : Ankit Kumar
// validation function

function Validate() {
	var fnameRegxp=/^([a-zA-Z]+)$/;
	var space=" ";
	var msg = "";
	var msg1 = "*Please enter\n ";
	if ( $F('txtName') == "") {
		msg+= "Your name\n";
	} else if(fnameRegxp.test($F('txtName'))!=true) {
		msg+="Valid name\n"
	}
	
	if ( $F('txtEmail') == "") {
		msg+= "Your Email address\n";
	} else if( !validateEmails( $F( 'txtEmail' ) ) ) {
		msg+="Valid Email address.\n";
	}
	
	if ( $F('txtPhone') == "") {
		msg+= "Your Phone Number\n";
	}
	
	if (msg != "") {
		msg1 += msg;
		alert(msg1);
		return false;
	} else {
		return true;	
	}
	
	
}

function isValidUsername(Username) {
	var pattern = /[^a-zA-Z0-9.@_-]+/;
	return ! pattern.test ( Username );
}

function validateEmails(email) {
	// a very simple email validation checking. 
	// you can add more complex email checking if it helps 
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null ) {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null) {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
	return false;
}
