function indicate_box(lay)
{
document.getElementById(lay).style.border='solid 3px #FF0000';
}


function disindicate_box(lay)
{
document.getElementById(lay).style.border='none';
}


//<------------Navigation rollover--------
function menurollover(m,img) 
{
//alert(img);
m.style.backgroundImage= "url("+img+")";
m.style.backgroundRepeat= "repeat-y"; 
m.style.backgroundPosition= "center top";
}

function hmenurollover(m,img) 
{
//alert(img);
m.style.backgroundImage= "url("+img+")";
m.style.backgroundRepeat= "repeat-x"; 
m.style.backgroundPosition= "left top";
}



function assigntoselectmenu(menuname,fieldvalue)
{
var s=document.getElementById(menuname);
for ( var i = 0; i < s.options.length; i++ ) {
if ( s.options[i].value == fieldvalue ) {
s.options[i].selected = true;
return;
}
}
}


function noNumbers(e)
{
	var keynum
	var keychar
	var numcheck
	
	if(window.event) // IE
	{
	keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
	keynum = e.which
	}
	keychar = String.fromCharCode(keynum)
	numcheck = /\d/
	//return !numcheck.test(keychar)
	return keynum;
}


function showcontent(page,title)
{
hideallcontents();
document.getElementById('heading').innerHTML=title;
document.getElementById(page).style.display='inline';
}


function hideallcontents()
{
document.getElementById('page0').style.display='none';
document.getElementById('page1').style.display='none';
document.getElementById('page2').style.display='none';
document.getElementById('page3').style.display='none';
document.getElementById('page4').style.display='none';
document.getElementById('contactusbox').style.display='none';
document.getElementById('searchresult').style.display='none';
document.getElementById('loginbox').style.display='none';
document.getElementById('messagebox').innerHTML='';
document.getElementById('messagebox').style.display='none';
}

function updateallimagelistsofqubits()
{
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=bodybackgroundimage','bodybackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=titlebarbackgroundimage','titlebarbackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=barbackgroundimage','barbackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=menucolumnbackgroundimage','menucolumnbackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=menubackgroundimage','menubackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=menuhoverbackgroundimage','menuhoverbackgroundimage_box');
writeanddisplay(commonpath+'/common/updateimagelists.php','fieldname=imagelistmenu','imagelist');
}


var cpanelshowvar ="intro";
var cpanelopenvar;

function cpanelshow(itemname)
{
//updateallimagelistsofqubits();
SetCookie ("cpanelopenvar", itemname) ;
cpanelshowvar=itemname+"_tab";
document.getElementById('intro_tab').className="menu";
document.getElementById('home_tab').className="menu";
document.getElementById('general_tab').className="menu";
document.getElementById('menu_tab').className="menu";
document.getElementById('boddy_tab').className="menu";
document.getElementById('frames_tab').className="menu";
document.getElementById('bars_tab').className="menu";
document.getElementById('custom_tab').className="menu";
document.getElementById('images_tab').className="menu";
document.getElementById('titlebar_tab').className="menu";
document.getElementById('banner_tab').className="menu";
document.getElementById('adsense_tab').className="menu";

document.getElementById(itemname+'_tab').className="menuhover";

document.getElementById('intro').style.display="none";
document.getElementById('general').style.display="none";
document.getElementById('menu').style.display="none";
document.getElementById('boddy').style.display="none";
document.getElementById('frames').style.display="none";
document.getElementById('home').style.display="none";
document.getElementById('bars').style.display="none";
document.getElementById('custom').style.display="none";
document.getElementById('images').style.display="none";
document.getElementById('titlebar').style.display="none";
document.getElementById('banner').style.display="none";
document.getElementById('adsense').style.display="none";

document.getElementById(itemname).style.display="inline";
$('#mainframe').redrawShadow();

}

function clearmessage()
{
document.getElementById('messagebox').innerHTML='';
}



function toggledisplay(layername)
{
div1 = document.getElementById(layername);
if (div1.style.display != 'inline') 
div1.style.display = 'inline';
 else 
div1.style.display = 'none';
}


function validate(str) 
{
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
   alert("Invalid E-mail ID")
   return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
   alert("Invalid E-mail ID")
   return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    alert("Invalid E-mail ID")
    return false
}

 if (str.indexOf(at,(lat+1))!=-1){
    alert("Invalid E-mail ID")
    return false
 }

 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    alert("Invalid E-mail ID")
    return false
 }

 if (str.indexOf(dot,(lat+2))==-1){
    alert("Invalid E-mail ID")
    return false
 }

 if (str.indexOf(" ")!=-1){
    alert("Invalid E-mail ID")
    return false
 }

 return true					
}



function readanddispaly(filename,displayplace)
{
 $.ajax({type: "GET",url: filename, success: function(result){ document.getElementById(displayplace).innerHTML= result; } });
}


function readandreturn(filename)
{

var html = $.ajax({ url: filename, async: false }).responseText;

return html;
}

function writeanddisplay(filename,transferingdata,displayplace)
{

$.ajax({
   type: "POST",
   url: filename,
   data: transferingdata,
   success: function(result)
   { 
   document.getElementById(displayplace).innerHTML= result; 
   }
 });
}


function displaypage(filename,imagename,title)
{

imgenam="<img src=\'images/" + imagename + "\' style=\'float:left;padding:5px;\'>";
document.getElementById('contentarea').innerHTML=imgenam+readandreturn(filename);
document.getElementById('heading').innerHTML=title.toUpperCase();
}


// <-----------COOKIE BEGINS---------->
function GetCookie (name) 
{  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) 
	{
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
	return getCookieVal (j);    
	i = document.cookie.indexOf(" ", i) + 1;    
	if (i == 0) break;   
	}  
return null;
}


function SetCookie (name, value) 
{  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}


function DeleteCookie (name) 
{  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);   
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','2')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}


function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

// -----------COOKIE ENDS---------->
