
// This function saves a cookie
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

// This function retrieves a cookie
function getCookie (name) {
	var cname = name + "=";               
	var dc = document.cookie;

    if (dc.length > 0) {              
		begin = dc.indexOf(cname);       
			if (begin != -1) {           
			begin += cname.length;       
			end = dc.indexOf(";", begin);
				if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
			} 
		}
	return null;
}
// This function deletes a cookie.
function delCookie(name) {
document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";
}
 
   	function fixDate(date) {
      var base = new Date(0)
      var skew = base.getTime()
      if (skew > 0)
         date.setTime(date.getTime() - skew)
   }   

function SetLimit(user,url)
 {
  var strurl;	 
  strurl=url;
  strurl=strurl.replace("\"","\'");  
  if (user=='')
  { 
  
   var now = new Date();
   fixDate(now);   
   //now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)   
   now.setTime(now.getTime() + 60 * 60 * 1000 );   
   var visits = getCookie("counter");
   if (!visits)
      visits = 1;
   else
  	 visits = parseInt(visits) + 1;
   if(visits <= 10 )	 
   {
   	setCookie("counter", visits, now);   
   }
  // document.write("You have been here " + visits + " time(s).")   	
	if(visits > 10 )
	{
		var frm=document.form1;
		alert('Your Maximum Limit Exceeded ! \n Please Signup or Login to view More Colleges Information ');	
		frm.action='/Login.asp';
		frm.submit();
	}		
	else
	  {
		window.location.pathname=strurl;		
	  }
	}
	else
		{
			window.location.pathname=strurl;		
		}
	}	
 
 function fnSetLimitwts(user,url)
 {
  if (user=='')
  { 
  
   var now = new Date();
   fixDate(now);   
   //now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)   
   now.setTime(now.getTime() + 60 * 60 * 1000 );   
   var visits = getCookie("wtscount");
   if (!visits)
      visits = 1;
   else
  	 visits = parseInt(visits) + 1;
   if(visits <= 10 )	 
   {
   	setCookie("wtscount", visits, now);   
   }
  // document.write("You have been here " + visits + " time(s).")   	
	if(visits > 10 )
	{
		var frm=document.form1;
		alert('Your Maximum Limit Exceeded ! \n Please Signup or Login to view More What To Study Documents');	
		frm.action='/Login.asp';
		frm.submit();
	}		
	else
	  {
		window.location.pathname=url;		
	  }
	}
	else
		{
			window.location.pathname=url;		
		}
	}	
		    

// JavaScript Document

/*function getCookie(c_name)
	{
	/*if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
		{
		c_start=c_start + c_name.length+1;
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		}
	 // }
	return "";
	}	
*/
//script to disable selection of text
/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
//end of script

function preLoadImages()
{	
	

    imgTabBg=new Image();
	imgTabBg.src="../res/images/tab.png";
	
	imgTabClg=new Image();
	imgTabClg.src="../res/images/tabshade.gif";
	
	imgTabactClg=new Image();
	imgTabactClg.src="../res/images/tabshadeactive.gif";
}


function fnCallLoadCompany(condn,divid)
{
	ajaxcombo(condn,divid);
}		

function fnforwardmail()
{
	window.open("/includes/User/Forwardurl.asp?pgURL="+window.location.href,"","width=600,height=400");				
}
	
function fnClearLoadCompany(Companycomboname)
{	
	document.getElementById(Companycomboname).options.length=0;
}	

function CalcKeyCode(aChar) 
{
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val) 
{
  var strPass = val.value;
  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);

  /* Check if the keyed in character is a number
     do you want alphabetic UPPERCASE only ?
     or lower case only just check their respective
     codes and replace the 48 and 57 */

  if (cCode < 48 || cCode > 57 ) {
    var myNumber = val.value.substring(0, (strLength) - 1);
	alert('Enter only Numeric value');
    val.value = myNumber;
  }
  return false;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function Right(str, n)
{
      if (n <= 0)
          return "";
      else if (n > String(str).length)
          return str;
      else
   {
          var iLen = String(str).length;
          return String(str).substring(iLen, iLen - n);
      }
}


function isblank(s) {
/************************************************
DESCRIPTION: Validates that a string is not all
  blank (whitespace) characters.

PARAMETERS:
value - the String to be tested for validity

RETURNS:
   True if valid, otherwise false.
*************************************************/

//alert(s);
     for (var i = 0; i < s.length; i++) {
          var c = s.charAt(i);
          if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
}
return true;
}
function CheckSelect(Obj,Errmsg)
{
		if(Obj.value=="")
		{
			if(isblank(Errmsg))
			alert("Please enter value for " + Obj.name);
			else
			alert(Errmsg);
			
			Obj.focus();
			return false;
		}
}
function CheckEmpty(Obj,Errmsg)
{	if (isblank(Obj.value)) {
		if(isblank(Errmsg))
		alert("Please enter value for " + Obj.name);
		else
		alert(Errmsg);
		Obj.focus();
		return false;
	}
	return true;
}

function generalvalidate(formobj)
{
	for(counter=0;counter<formobj.elements.length;counter++)
	{
			objs=formobj.elements[counter];
			if(objs.type!="hidden")
				if(isblank(objs.value))
				{
						alert("Please enter value for "+objs.name);
						objs.focus();
						return false;
				}
	}
}

function validateemail(em)
{

	var mailvalid=0;
	if(em.indexOf(".")==-1 || em.indexOf("@")==-1 )
	mailvalid=1;
	if(em.substring(0,em.indexOf("@")-1).length <1)
		mailvalid=1;
	if(em.substring(em.indexOf("@")+1,em.indexOf(".")).length<1)
		mailvalid=1;
	if(em.substring((eval(em.indexOf("."))+eval(1)),em.length).length<1)
		mailvalid=1;
	return mailvalid;
}

function ValidUsername(uname, Errmsg)
{
var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";
  for (var i = 0; i < uname.value.length ; i++) 
  	{
		if (iChars.indexOf(uname.value.charAt(i)) != -1) 
			{
			if(isblank(Errmsg))
				alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again.");
				else
					alert(Errmsg);
					uname.focus();
					return false;
  			}
  }
}
function checkphone(val)
{
	str="1234567890";
	le=val.length;
	for(i=0;i<l;i++)
	{
		alert(str.indexOf(vals.charAt(i))>0);
	}
}

function CheckStr(Obj,str,Errmsg)
{
l=Obj.value.length;
vals=Obj.value;
//alert(str.indexOf(vals.charAt(2)))
	if(isblank(Obj.value))
	{
		alert("Please Enter value for "+ Obj.name);
		Obj.focus();
		return false;
	}
	else
	{
		for(i=0;i<=l;i++)
		{
			if(str.indexOf(vals.charAt(i))<0)
			{
				if(isblank(Errmsg))
				alert("Please enter valid value for "+Obj.name);
				else
				alert(Errmsg);
				
				Obj.focus();
				return false;
			}
		}
	}
	return true;
}

function CheckValueMax(Obj,maxval,Errmsg)
{
	if(Obj.value>maxval)
	{
		if(isblank(Errmsg))
		alert("Please enter value less than "+ maxval);
		else
		alert(Errmsg);
		
		Obj.focus();
		return false;
	}
	return true;
}

function CheckLength(Obj,len,minmax,Errmsg)
{
	if(minmax=="<")
	{
		if(Obj.value.length<=len)
		{
			if(isblank(Errmsg))
			alert("Please Enter length greater than "+ len + " for " + Obj.name);
			else
			alert(Errmsg);
			
			Obj.focus();
			return false;
		}
	}
	else if(minmax==">")
	{
		if(Obj.value.length>=len)
		{
			if(isblank(Errmsg))
			alert("Please Enter length less than "+ len + " for " + Obj.name);
			else
			alert(Errmsg);
			
			Obj.focus();
			return false;
		}
	}
	return true;
}

function CheckEmail(Obj,Errmsg)
{
	if(validateemail(Obj.value)==1)
	{
		if(isblank(Errmsg))
		alert("Please enter valid Email for "+Obj.name);
		else
		alert(Errmsg);
		
		Obj.focus()
		return false;
	}
	return true;
}


function checknumbersonly(vals)
{
//str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYS._', "
str="1234567890";
//l=obj.value.length;
l=vals.length;
for(i=0;i<=l;i++)
{
	if(str.indexOf(vals.charAt(i))>0)
	{
		//alert("Enter Characters only");
		//obj.value="";
		//obj.focus();
		return false;
	}
}
}
function checkcheckbox(obj)
{
	k=0;
//if return value - 0 , there is no object is selected
	if (obj.length)
	{
		for(ii=0;ii<obj.length;ii++)
		{
		 if (obj[ii].checked==true)
			   k=1;
		 }
	}
	else
	{
		if (obj.checked==true)
		k=1;
	}
return k;
}
function checkcheckboxone(obj)
{		
		k=0;
		if (obj.length)
		{
			for(ii=0;ii<obj.length;ii++)
			{
			 if (obj[ii].checked==true)
			 {
				   k=k+1;
				   reportid=obj[ii].value;
			 }
			 }
		}
		else
		{
			if (obj.checked==true)
			{
			k=1;
			}
		}
return k;
}

function checkUncheckAll(theElement) {
 var theForm = theElement.form, z = 0;
 for(z=0; z<theForm.length;z++){
  if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall' && theForm[z].id != 'check_ignore'){
  theForm[z].checked = theElement.checked;
  }
 }
} 

function editsingle(pagename)
{
	document.forms[0].operation.value="edit";
	document.forms[0].action=pagename;
	document.forms[0].submit();
}

function edit(control,pagename)
{
	if(editcheck(control)!=1)
	{
		alert("Please select only one checkbox to Edit");
	}
	else
	{
		document.forms[0].operation.value="edit";
		document.forms[0].action=pagename;
//		+"?pageno="+pageno;
		document.forms[0].submit();
	}
}

function add(pagename)
{
	document.forms[0].operation.value="add";
	document.forms[0].action=pagename;
	document.forms[0].submit();
}

function operate(chkcontrol,op,page,hidval)
{
	var flag=0;
	hidval.value=op;
	if(checkcheckbox(chkcontrol)==0)
	alert("Please select atleast one to "+op);
	else
	flag=1;
	
	if(flag==1)
	{
		if(op=="delete")
		{
			if(confirm("Are you sure, you want to delete"))
			{
				document.forms[0].action=page;
				document.forms[0].submit();
			}
		}
		else
		{
			document.forms[0].action=page;
			document.forms[0].submit();
		}
	}
	//checkcheckboxone
}

function operatesingle(op,page,hidval)
{
	var flag=1;
	hidval.value=op;
	if(op=="delete")
	{
		if(confirm("Are you sure, you want to delete"))
		{
			document.forms[0].action=page;
			document.forms[0].submit();
		}
	}
	else
	{
		document.forms[0].action=page;
		document.forms[0].submit();
	}
}

function editcheck(obj)
{		
		var reportid;
		var nan;
		k=0;
		if (obj.length)
		{
			for(ii=0;ii<obj.length;ii++)
			{
			 if (obj[ii].checked==true)
			 {
				   k=k+1;
				   reportid=obj[ii].value;
				   nan=ii;
			 }
			 }
		}
		else
		{
			if (obj.checked==true)
			{
			k=1;
		   reportid=obj.value;
		   nan=0;
			}
		}
		return k;
		//have to check k==1 then one is checked. 
		/*
		if(k==1)
		{
			document.form1.operation.value="edit";
			if(nan==0)
			document.form1.AdminId.value=obj.value;
			else
			document.form1.AdminId.value=obj[nan].value;
			
			document.form1.action="addadmin.asp";
			document.form1.submit();
		}
		else
		{
			alert("Please select only one check box to edit");
		}*/
} 
function lengthcheck(vals,maxlen,Errmsg)
{
	if(vals.length>maxlen)
	{
		if(isblank(Errmsg))
		alert("Please Enter less than "+ maxlen + " characters");
		else
		alert(Errmsg);
	}
}
function pagesubmit(page)
{
	document.forms[0].action=page;
	document.forms[0].submit();
}
function Open(page)
{
	document.forms[0].action=page;
	document.forms[0].submit();
}

function gotopage(pcount)
{
var pageno;
pageno=document.forms[0].pageno.value;
if(CheckStr(document.forms[0].pageno,"1234567890","")==false)
{
	return false;
}
else
{
	if (pcount<pageno)
	{
		alert("Please enter valid page no. Total pages are : "+pcount);
		document.forms[0].pageno.focus();
		return false;
	}
	movepageto(pageno);
}
}
function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}


function move(fbox, tbox) {    
	var arrFbox = new Array();     
	var arrTbox = new Array();     
	var arrLookup = new Array();     
	var i;     
	for (i = 0; i < tbox.options.length; i++) {     
		arrLookup[tbox.options[i].text] = tbox.options[i].value;     
		arrTbox[i] = tbox.options[i].text;     
	}     
	
	var fLength = 0;     
	var tLength = arrTbox.length;    

	for(i = 0; i < fbox.options.length; i++) {     
		arrLookup[fbox.options[i].text] = fbox.options[i].value;     
		if (fbox.options[i].selected && fbox.options[i].value != "") {     
			arrTbox[tLength] = fbox.options[i].text;     
			tLength++;     
		}     
		else {     
			arrFbox[fLength] = fbox.options[i].text;     
			fLength++;     
		}     
	}     
	
	arrFbox.sort();     
	arrTbox.sort();     
	fbox.length = 0;     
	tbox.length = 0;    
	var c;     
	
	for(c = 0; c < arrFbox.length; c++) {     
		var no = new Option();     
		no.value = arrLookup[arrFbox[c]];     
		no.text = arrFbox[c];     
		fbox[c] = no;     
	}     
	
	for(c = 0; c < arrTbox.length; c++) {     
		var no = new Option();     
		no.value = arrLookup[arrTbox[c]];     
		no.text = arrTbox[c];     
		tbox[c] = no;     
	}     
}      

function selectAll(box) {     
	for(var i=0; i<box.length; i++) {     
		box[i].selected = true;     
	}     
}     
	//  End -->     





//** Ajax Tabs Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 21st, 07 to version 2.0. Contains numerous improvements
//** Updated Feb 18th, 08 to version 2.1: Adds a public "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically. Only .js file changed from v2.0.
//** Updated April 8th, 08 to version 2.2:
//   -Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0) 
//   -Modified Ajax routine so testing the script out locally in IE7 now works 

var ddajaxtabssettings={}
ddajaxtabssettings.bustcachevar=1  //bust potential caching of external pages after initial request? (1=yes, 0=no)
ddajaxtabssettings.loadstatustext="<img src='res/images/loading.gif' /> Requesting content..." 


////NO NEED TO EDIT BELOW////////////////////////

function ddajaxtabs(tabinterfaceid, contentdivid){
	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
	this.enabletabpersistence=true
	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
	this.contentdivid=contentdivid
	this.defaultHTML=""
	this.defaultIframe='<iframe src="about:blank" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" class="tabcontentiframe" style="width:100%; height:auto; min-height: 100px"></iframe>'
	this.defaultIframe=this.defaultIframe.replace(/<iframe/i, '<iframe name="'+"_ddajaxtabsiframe-"+contentdivid+'" ')
this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddajaxtabs.connect=function(pageurl, tabinstance){
	var page_request = false
	var bustcacheparameter=""
	if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else
		return false
	var ajaxfriendlyurl=pageurl.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/") 
	page_request.onreadystatechange=function(){ddajaxtabs.loadpage(page_request, pageurl, tabinstance)}
	if (ddajaxtabssettings.bustcachevar) //if bust caching of external page
		bustcacheparameter=(ajaxfriendlyurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', ajaxfriendlyurl+bustcacheparameter, true)
	page_request.send(null)
}

ddajaxtabs.loadpage=function(page_request, pageurl, tabinstance){
	var divId=tabinstance.contentdivid
	document.getElementById(divId).innerHTML=ddajaxtabssettings.loadstatustext //Display "fetching page message"
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(divId).innerHTML=page_request.responseText
		ddajaxtabs.ajaxpageloadaction(pageurl, tabinstance)
	}
}

ddajaxtabs.ajaxpageloadaction=function(pageurl, tabinstance){
	tabinstance.onajaxpageload(pageurl) //call user customized onajaxpageload() function when an ajax page is fetched/ loaded
}

ddajaxtabs.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

ddajaxtabs.setCookie=function(name, value){
	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddajaxtabs.prototype={

	expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
		this.cancelautorun() //stop auto cycling of tabs (if running)
		var tabref=""
		try{
			if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=document.getElementById(tabid_or_position)
			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=this.tabs[tabid_or_position]
		}
		catch(err){alert("Invalid Tab ID or position entered!")}
		if (tabref!="") //if a valid tab is found based on function parameter
			this.expandtab(tabref) //expand this tab
	},

	cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
		if (dir=="next"){
			var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
		}
		else if (dir=="prev"){
			var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
		}
		if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
			this.cancelautorun() //stop auto cycling of tabs (if running)
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
	},

	setpersist:function(bool){ //PUBLIC function to toggle persistence feature
			this.enabletabpersistence=bool
	},

	loadajaxpage:function(pageurl){ //PUBLIC function to fetch a page via Ajax and display it within the Tab Content instance's container
		ddajaxtabs.connect(pageurl, this)
	},

	loadiframepage:function(pageurl){ //PUBLIC function to fetch a page and load it into the IFRAME of the Tab Content instance's container
		this.iframedisplay(pageurl, this.contentdivid)
	},

	setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
		this.selectedClassTarget=objstr || "link"
	},

	getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
		return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
	},

	urlparamselect:function(tabinterfaceid){
		var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
		return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
	},

	onajaxpageload:function(pageurl){ //PUBLIC Event handler that can invoke custom code whenever an Ajax page has been fetched and displayed
		//do nothing by default
	},

	expandtab:function(tabref){
		var relattrvalue=tabref.getAttribute("rel")
		//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easy searching through
		var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
		if (relattrvalue=="#default")
			document.getElementById(this.contentdivid).innerHTML=this.defaultHTML
		else if (relattrvalue=="#iframe")
			this.iframedisplay(tabref.getAttribute("href"), this.contentdivid)
		else
			ddajaxtabs.connect(tabref.getAttribute("href"), this)
		this.expandrevcontent(associatedrevids)
		for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
			this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("href")==tabref.getAttribute("href"))? "selected" : ""
		}
		if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
			ddajaxtabs.setCookie(this.tabinterfaceid, tabref.tabposition)
		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
	},

	iframedisplay:function(pageurl, contentdivid){
		if (typeof window.frames["_ddajaxtabsiframe-"+contentdivid]!="undefined"){
			try{delete window.frames["_ddajaxtabsiframe-"+contentdivid]} //delete iframe within Tab content container if it exists (due to bug in Firefox)
			catch(err){}
		}
		document.getElementById(contentdivid).innerHTML=this.defaultIframe
		window.frames["_ddajaxtabsiframe-"+contentdivid].location.replace(pageurl) //load desired page into iframe
	},


	expandrevcontent:function(associatedrevids){
		var allrevids=this.revcontentids
		for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
			//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
			document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
		}
	},

	setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
		for (var i=0; i<this.hottabspositions.length; i++){
			if (tabposition==this.hottabspositions[i]){
				this.currentTabIndex=i
				break
			}
		}
	},

	autorun:function(){ //function to auto cycle through and select tabs based on a set interval
		this.cycleit('next', true)
	},

	cancelautorun:function(){
		if (typeof this.autoruntimer!="undefined")
			clearInterval(this.autoruntimer)
	},

	init:function(automodeperiod){
		var persistedtab=ddajaxtabs.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
		var selectedtab=-1 //Currently selected tab index (-1 meaning none)
		var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
		this.automodeperiod=automodeperiod || 0
		this.defaultHTML=document.getElementById(this.contentdivid).innerHTML
		for (var i=0; i<this.tabs.length; i++){
			this.tabs[i].tabposition=i //remember position of tab relative to its peers
			if (this.tabs[i].getAttribute("rel")){
				var tabinstance=this
				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
				this.tabs[i].onclick=function(){
					tabinstance.expandtab(this)
					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
					return false
				}
				if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
				}
				if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
					selectedtab=i //Selected tab index, if found
				}
			}
		} //END for loop
		if (selectedtab!=-1) //if a valid default selected tab index is found
			this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
		else //if no valid default selected index found
			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
		if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
			this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
		}
	} //END int() function

} //END Prototype assignment








//** AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm
//** January 29th, 2009: Script Creation date

var anylinkmenu={

menusmap: {},
effects: {delayhide: 200, shadow:{enabled:true, opacity:0.3, depth: [5, 5]}, fade:{enabled:false, duration:500}}, //customize menu effects

dimensions: {},

getoffset:function(what, offsettype){
	return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
},

getoffsetof:function(el){
	el._offsets={left:this.getoffset(el, "offsetLeft"), top:this.getoffset(el, "offsetTop"), h: el.offsetHeight}
},

getdimensions:function(menu){
	this.dimensions={anchorw:menu.anchorobj.offsetWidth, anchorh:menu.anchorobj.offsetHeight,
		docwidth:(window.innerWidth ||this.standardbody.clientWidth)-20,
		docheight:(window.innerHeight ||this.standardbody.clientHeight)-15,
		docscrollx:window.pageXOffset || this.standardbody.scrollLeft,
		docscrolly:window.pageYOffset || this.standardbody.scrollTop
	}
	if (!this.dimensions.dropmenuw){
		this.dimensions.dropmenuw=menu.dropmenu.offsetWidth
		this.dimensions.dropmenuh=menu.dropmenu.offsetHeight
	}
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

setopacity:function(el, value){
	el.style.opacity=value
	if (typeof el.style.opacity!="string"){ //if it's not a string (ie: number instead), it means property not supported
		el.style.MozOpacity=value
		if (el.filters){
			el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+ value*100 +")"
		}
	}
},

showmenu:function(menuid){
	var menu=anylinkmenu.menusmap[menuid]
	clearTimeout(menu.hidetimer)
	this.getoffsetof(menu.anchorobj)
	this.getdimensions(menu)
	var posx=menu.anchorobj._offsets.left + (menu.orientation=="lr"? this.dimensions.anchorw : 0) //base x pos
	var posy=menu.anchorobj._offsets.top+this.dimensions.anchorh - (menu.orientation=="lr"? this.dimensions.anchorh : 0)//base y pos
	if (posx+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth){ //drop left instead?
		posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
	}
	if (posy+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight){  //drop up instead?
		posy=Math.max(posy-this.dimensions.dropmenuh - (menu.orientation=="lr"? -this.dimensions.anchorh : this.dimensions.anchorh), this.dimensions.docscrolly) //position above anchor or window's top edge
	}
	if (this.effects.fade.enabled){
		this.setopacity(menu.dropmenu, 0) //set opacity to 0 so menu appears hidden initially
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, 0) //set opacity to 0 so shadow appears hidden initially
	}
	menu.dropmenu.setcss({left:posx+'px', top:posy+'px', visibility:'visible'})
	if (this.effects.shadow.enabled){
		//menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
		menu.shadow.setcss({left:posx+anylinkmenu.effects.shadow.depth[0]+'px', top:posy+anylinkmenu.effects.shadow.depth[1]+'px', visibility:'visible'})
	}
	if (this.effects.fade.enabled){
		clearInterval(menu.animatetimer)
		menu.curanimatedegree=0
		menu.starttime=new Date().getTime() //get time just before animation is run
		menu.animatetimer=setInterval(function(){anylinkmenu.revealmenu(menuid)}, 20)
	}
},

revealmenu:function(menuid){
	var menu=anylinkmenu.menusmap[menuid]
	var elapsed=new Date().getTime()-menu.starttime //get time animation has run
	if (elapsed<this.effects.fade.duration){
		this.setopacity(menu.dropmenu, menu.curanimatedegree)
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, menu.curanimatedegree*this.effects.shadow.opacity)
	}
	else{
		clearInterval(menu.animatetimer)
		this.setopacity(menu.dropmenu, 1)
		menu.dropmenu.style.filter=""
	}
	menu.curanimatedegree=(1-Math.cos((elapsed/this.effects.fade.duration)*Math.PI)) / 2
},

setcss:function(param){
	for (prop in param){
		this.style[prop]=param[prop]
	}
},

hidemenu:function(menuid){
	var menu=anylinkmenu.menusmap[menuid]
	clearInterval(menu.animatetimer)
	menu.dropmenu.setcss({visibility:'hidden', left:0, top:0})
	menu.shadow.setcss({visibility:'hidden', left:0, top:0})
},

getElementsByClass:function(targetclass){
	if (document.querySelectorAll)
		return document.querySelectorAll("."+targetclass)
	else{
		var classnameRE=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "i") //regular expression to screen for classname
		var pieces=[]
		var alltags=document.all? document.all : document.getElementsByTagName("*")
		for (var i=0; i<alltags.length; i++){
			if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
				pieces[pieces.length]=alltags[i]
		}
		return pieces
	}
},

addDiv:function(divid, divclass, inlinestyle){
	var el=document.createElement("div")
	if (divid)
		el.id=divid
	el.className=divclass
	if (inlinestyle!="" && typeof el.style.cssText=="string")
		el.style.cssText=inlinestyle
	else if (inlinestyle!="")
		el.setAttribute('style', inlinestyle)
	document.body.appendChild(el)
	return el
},

getmenuHTML:function(menuobj){
	var menucontent=[]
	var frag=""
	for (var i=0; i<menuobj.items.length; i++){
		frag+='<li><a href="' + menuobj.items[i][1] + '" target="' + menuobj.linktarget + '">' + menuobj.items[i][0] + '</a></li>\n'
		if (menuobj.items[i][2]=="efc" || i==menuobj.items.length-1){
			menucontent.push(frag)
			frag=""
		}
	}
	if (typeof menuobj.cols=="undefined")
		return '<ul>\n' + menucontent.join('') + '\n</ul>'
	else{
		frag=""
		for (var i=0; i<menucontent.length; i++){
			frag+='<div class="' + menuobj.cols.divclass + '" style="' + menuobj.cols.inlinestyle + '">\n<ul>\n' + menucontent[i] + '</ul>\n</div>\n'
		}
		return frag
	}
},

addEvent:function(targetarr, functionref, tasktype){
	if (targetarr.length>0){
		var target=targetarr.shift()
		if (target.addEventListener)
			target.addEventListener(tasktype, functionref, false)
		else if (target.attachEvent)
			target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)})
		this.addEvent(targetarr, functionref, tasktype)
	}
},

setupmenu:function(targetclass, anchorobj, pos){
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	var relattr=anchorobj.getAttribute("rel")
	dropmenuid=relattr.replace(/\[(\w+)\]/, '')
	var dropmenuvar=window[dropmenuid]
	var dropmenu=this.addDiv(null, dropmenuvar.divclass, dropmenuvar.inlinestyle) //create and add main sub menu DIV
	dropmenu.innerHTML=this.getmenuHTML(dropmenuvar)
	var menu=this.menusmap[targetclass+pos]={
		id: targetclass+pos,
		anchorobj: anchorobj,	
		dropmenu: dropmenu,
		revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click")? "click" : "mouseover",
		orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",
		shadow: this.addDiv(null, "anylinkshadow", null) //create and add corresponding shadow
	}
	menu.anchorobj._internalID=targetclass+pos
	menu.anchorobj._isanchor=true
	menu.dropmenu._internalID=targetclass+pos
	menu.shadow._internalID=targetclass+pos
	menu.dropmenu.setcss=this.setcss
	menu.shadow.setcss=this.setcss
	menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
	this.setopacity(menu.shadow, this.effects.shadow.opacity)
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOVER event for anchor, dropmenu, shadow
		var menu=anylinkmenu.menusmap[this._internalID]
		if (this._isanchor && menu.revealtype=="mouseover" && !anylinkmenu.isContained(this, e)){ //event for anchor
			anylinkmenu.showmenu(menu.id)
		}
		else if (typeof this._isanchor=="undefined"){ //event for drop down menu and shadow
			clearTimeout(menu.hidetimer)
		}
	}, "mouseover")
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOUT event for anchor, dropmenu, shadow
		if (!anylinkmenu.isContained(this, e)){
			var menu=anylinkmenu.menusmap[this._internalID]
			menu.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(menu.id)}, anylinkmenu.effects.delayhide)
		}
	}, "mouseout")
	this.addEvent([menu.anchorobj, menu.dropmenu], function(e){ //CLICK event for anchor, dropmenu
		var menu=anylinkmenu.menusmap[this._internalID]
		if ( this._isanchor && menu.revealtype=="click"){
			if (menu.dropmenu.style.visibility=="visible")
				anylinkmenu.hidemenu(menu.id)
			else
				anylinkmenu.showmenu(menu.id)
			if (e.preventDefault)
				e.preventDefault()
			return false
		}
		else
			menu.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(menu.id)}, anylinkmenu.effects.delayhide)
	}, "click")
},

init:function(targetclass){
	var anchors=this.getElementsByClass(targetclass)
	for (var i=0; i<anchors.length; i++){
		this.setupmenu(targetclass, anchors[i], i)
	}
}

}


// This Functions are used for html Generation start
function fnshowaffcolleges(unid)
	{
		var frm=document.form1;		
		frm.universityid.value=unid;		
		frm.action="../../Affiliated-colleges.asp";
		frm.submit();				 			
	}	
	function fnShwfullcomment(span,spanfull)
	{		
		document.getElementById(spanfull).style.display="";
		document.getElementById(span).style.display='none';				
	}
	
	var geocoder;
  	var map;
  function initialize() {
  
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(13.04, 80.24);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
  
  
  function codeAddress(){
	  var address = document.form1.address.value;
	  geocoder.geocode( { 'address': address}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location,13);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
		});
		} 
    });
	  
  }
  

  function SDMenunew() {
	  	var myMenu;
		myMenu = new SDMenu("my_menu");
		myMenu.init();
	
	myMenu.expandMenu(myMenu.submenus[8])
	}
	function SDMenuCol() {
	  	var myMenu;
		myMenu = new SDMenu("my_menu");
		myMenu.init();
	
	myMenu.expandMenu(myMenu.submenus[2])
	}
	function SDMenuScholarship() {
	  	var myMenu;
		myMenu = new SDMenu("my_menu");
		myMenu.init();
	
	myMenu.expandMenu(myMenu.submenus[5])
	}
	
	
	function fnShwdtl(divid)
	{	
	
		document.getElementById("college_details").style.display='none';
		document.getElementById("courses_offered").style.display='none';	
		document.getElementById("rating_ranking").style.display='none';
		document.getElementById("alumni_group").style.display='none';
		document.getElementById("placement").style.display='none';
		document.getElementById("hostel").style.display='none';
		
		
		document.getElementById("college_details1").className='none';
		document.getElementById("courses_offered1").className='none';
		document.getElementById("rating_ranking1").className='none';
		document.getElementById("alumni_group1").className='none';
		document.getElementById("placement1").className='none';
		document.getElementById("hostel1").className='none';
		
		document.getElementById(divid).style.display='block';
		document.getElementById(divid+'1').className='active';
		
		
	}	
// used in top area start
function fnCaropt(filenm,jobsubfield)
{
	var frm=document.form1;
	frm.cflnm.value=filenm;
	frm.Job_sub_field_sno.value=jobsubfield;		
	frm.action="/Career-options/";
	frm.submit();			
}
function fnSetClgtype(clgtype,inttype) 
{
	//alert(inttype+clgtype);		
	var frm=document.form1;		
	frm.hdnclgtype.value='';
	frm.hdnclgtype.value=clgtype;
	frm.hdninttype.value=inttype;		
	if(frm.State)
	{		
		frm.State.value='';		
	}
	if(frm.District)
	{		
		frm.District.value='';		
	}
	if(frm.Jobfield_id)
	{		
		frm.Jobfield_id.value='';		
	}
	if(frm.showoption)
	{		
		frm.showoption.value='yes';		
	}		
	var folder,url;
	if(frm.hdnclgtype.value!='')	
	{
	folder=clgtype.replace("  ","-");	
	folder=folder.replace(" ","-");	
	folder=folder.replace("&","-");	
	folder=folder.replace("/","-");	
	folder=folder.replace(" ","");		
	folder=folder.replace("--","-");
	folder=folder.replace(" ","-");		
	folder=folder.substr(0,1).toUpperCase()+folder.substr(1);		
	url="/Colleges/"+folder+"/";			
	}
	else
	{
	  url="/College-Search.asp";
	}
	frm.clgtypurl.value=url;
	frm.action=url;
	frm.submit();	
}
	function fnSetClgtypeval(clgtype,inttype) 
	{
		var frm=document.form1;				
		frm.hdnclgtype.value=clgtype;
		frm.hdninttype.value=inttype;
	}
	
// used in top area End

// used in Right nav start
function fnSubscribe()
{
	var frm=document.form1;	
	email=frm.newsl_email;
	if(CheckEmpty(frm.newsl_email,"Please Enter E-Mail")==false)
		return false;
	if(CheckEmail(frm.newsl_email,"Please Enter valid E-mail address ")==false)
		return false;	
	ajaxcombo(frm.newsl_email.value,'div_subscribe');
}

function fnAskSubmit()
{
	frm=document.form1;
	if(frm.degree.value=="")
	{
		alert("Please Select Degree")
		frm.degree.focus()
		return false;
	}
	if(frm.stuName.value=="Full Name*")
	{
		alert("Please Enter Your Name")
		frm.stuName.focus()
		return false;
	}
	if(frm.stuMobile.value=="Mobile Number*")
	{
		alert("Please Enter Your Mobile Number")
		frm.stuMobile.focus()
		return false;
	}
	
	if(frm.stuEmail.value=="E-Mail*")
	{
		alert("Please Enter Your Email ID")
		frm.stuEmail.focus()
		return false;
	}
	if(CheckEmail(frm.stuEmail,"Please Enter valid Email ID")==false)
				return false;
	if(frm.Comment.value=="Your Query*")
	{
		alert("Please Enter Your Query")
		frm.Comment.focus()
		return false;
	}
	

	frm.action="../../ask_Qus_College.asp?stuName="+frm.stuName.value;
	frm.submit();
	
}
// used in Right nav end

//This Functions are used for html Generation End




