// slide show-1
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'engineering/students.jpg'
Pic[1] = 'engineering/students2.jpg'
Pic[2] = 'engineering/lab1.jpg'
Pic[3] = 'engineering/lecture1.jpg'
Pic[4] = 'engineering/team-fe.jpg'
Pic[5] = 'engineering/team-comp.jpg'
Pic[6] = 'engineering/team-it.jpg'
Pic[7] = 'engineering/team-extc.jpg'
Pic[8] = 'engineering/team-mba.jpg'
Pic[9] = 'engineering/team-nonteaching.jpg'

// do not edit anything below this line
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
//  End -->

/*
// slide show-2
// Set slideShowSpeed (milliseconds)
var slideShowSpeed2 = 5000;
// Duration of crossfade (seconds)
var crossFadeDuration2 = 3;
// Specify the image files
var Pic2 = new Array();
Pic2[0] = '/engineering/visionimage.jpg'
Pic2[1] = '/engineering/mba2.jpg'
Pic2[2] = '/engineering/lecture2.jpg'
Pic2[3] = '/engineering/lab2.jpg'
Pic2[4] = '/engineering/seminar2.jpg'
Pic2[5] = '/engineering/seminar4.jpg'
Pic2[6] = '/engineering/best-engineering.jpg'

// do not edit anything below this line
var t2;
var j2 = 0;
var p2 = Pic2.length;
var preLoad2 = new Array();
for (i2 = 0; i2 < p2; i2++) {
preLoad2[i2] = new Image();
preLoad2[i2].src = Pic2[i2];
}
function runSlideShow2() {
if (document.all) {
document.images.SlideShow2.style.filter="blendTrans(duration=2)";
document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow2.filters.blendTrans.Apply();
}
document.images.SlideShow2.src = preLoad2[j2].src;
if (document.all) {
document.images.SlideShow2.filters.blendTrans.Play();
}
j2 = j2 + 1;
if (j2 > (p2 - 1)) j2 = 0;
t2 = setTimeout('runSlideShow2()', slideShowSpeed2);
}
//  End -->
*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i>a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validatefrm(t,secverify)
{

	if(t.name.value=="")
	{
		alert("Please specify your Name....");
		t.name.focus();
		return 0;
	}
		var emailID=t.email
		if (echeck(emailID.value)==false)
		{
			emailID.focus()
			return false
		}
			  if(secverify==1)
	  	{
	Item = t.sectorname.selectedIndex; 
	Result1 = t.sectorname.options[Item].text; 

    if (Result1 == "---- Select ----") 
	{
		alert("Please specify your Sector Name....");
		t.sectorname.focus();
		return false;
	}
	}
	if(secverify==2)
  	{
		if(t.dkeyword.value=="")
		{
			alert("Please specify your desired Keyword....");
			t.dkeyword.focus();
			return 0;
		}
	Item = t.shortcode.selectedIndex; 
	Result1 = t.shortcode.options[Item].text; 

    if (Result1 == "--- Select ---") 
	{
		alert("Please specify Short Code you wish to opt....");
		t.shortcode.focus();
		return false;
	}
	}
	if(secverify==3)
  	{
		if(t.dqty.value=="" || (t.dqty.value>='a' && t.dqty.value<='z') || (t.dqty.value>='A' && t.dqty.value<='Z'))
		{
			alert("Please specify your Numeric desired Bulk SMS Quantity....");
			t.dqty.focus();
			return 0;
		}
		if(t.dcountry.value=="")
		{
			alert("Please specify your desired Bulk sms Target Country....");
			t.dcountry.focus();
			return 0;
		}
	}

	if(t.comments.value=="")
	{
		alert("Please specify your Comments/ Suggestions....");
		t.comments.focus();
		return 0;
	}
	if(t.strCAPTCHA.value=="")
	{
		alert("Please specify Capture Code above - Used to Control Automated E-mail Postings....");
		t.strCAPTCHA.focus();
		return 0;
	}
	  
	t.submit();
	return 1;
}
function validatefrm2(t,secverify)
{
	if(t.name2.value=="")
	{
		alert("Please specify your Name....");
		t.name2.focus();
		return 0;
	}
		var emailID=t.email2
		if (echeck(emailID.value)==false)
		{
			emailID.focus()
			return false
		}
			if(t.comments2.value=="")
	{
		alert("Please specify your Comments/ Suggestions....");
		t.comments2.focus();
		return 0;
	}
	if(t.strCAPTCHA2.value=="")
	{
		alert("Please specify Capture Code above - Used to Control Automated E-mail Postings....");
		t.strCAPTCHA2.focus();
		return 0;
	}
	  
	t.submit();
	return 1;
}

function checklogin(t)
{
		var emailID=t.email
		if (echeck(emailID.value)==false)
		{
			emailID.focus()
			return false
		}
			if(t.password.value=="")
	{
		alert("Please specify your password....");
		t.password.focus();
		return 0;
	}
	  
	t.submit();
	return 1;
}


function validatefrm21(t,secverify)
{

	course=t.course.selectedIndex;
	course=t.course.options[course].value;
	if (course==0)
	{
		alert("Please specify the Engineering branch you wish to enquire about?")
		t.course.focus();
		return 0;
	}
	if(t.name2.value=="")
	{
		alert("Please specify your Name....");
		t.name2.focus();
		return 0;
	}
		var emailID=t.email2
		if (echeck(emailID.value)==false)
		{
			emailID.focus()
			return false
		}
			if(t.comments2.value=="")
	{
		alert("Please specify your Comments/ Suggestions....");
		t.comments2.focus();
		return 0;
	}
	if(t.strCAPTCHA2.value=="")
	{
		alert("Please specify Capture Code above - Used to Control Automated E-mail Postings....");
		t.strCAPTCHA2.focus();
		return 0;
	}
	  
	t.submit();
	return 1;
}


function resetvalue(ffield)
{	
	ffield.value="";
	return 1;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function getimg(cntt,ipath)
{
	window.open("dispimgf70c.html?i=" + cntt + "&folder=" + ipath,"viewimage","resizable=yes,toolbar=0,location=0,menubar=0,status=0,height=700,top=14,left=62,width=900,,scrollbars=1");	
	//window.open("dispimg.asp?i=" + ipath,"viewimage","resizable=yes,toolbar=0,location=0,menubar=0,status=0,height=700,top=14,left=62,width=900,,scrollbars=1");	
	//window.document.getElementById('image').innerHTML="<img src='" + ipath + "' border=0>";
}


function replacecarriagereturn(textarea,replaceWith)   
{    
 textarea.value = escape(textarea.value);   
  //encode all characters in text area   
  //to find carriage return character   
 for(i=0; i < textarea.value.length; i++)   
 {    
  //loop through string, replacing carriage return    
  //encoding with HTML break tag   
  if(textarea.value.indexOf("%0D%0A") > -1)   
  {    
   //Windows encodes returns as \r\n hex   
   textarea.value=textarea.value.replace("%0D%0A",replaceWith);   
  }   
 else if(textarea.value.indexOf("%0A") > -1)   
  {    
   //Unix encodes returns as \n hex   
   textarea.value=textarea.value.replace("%0A",replaceWith);   
  }   
  else if(textarea.value.indexOf("%0D") > -1)   
  {    
  //Macintosh encodes returns as \r hex   
 textarea.value=textarea.value.replace("%0D",replaceWith);   
}   
}   
textarea.value=unescape(textarea.value);   
//decode all characters in text area back 
}
function vernotice(t)
{
	replacecarriagereturn(t.description,"<br>");
	if(t.type.value=="")
	{
		alert("Please specify notice type...");
		t.type.focus();
		return 0;
	}
	if(t.description.value=="")
	{
		alert("Please specify descrption...");
		t.description.focus();
		return 0;
	}
	t.action="addscrollnotice.html";
	t.submit();
	return 1;
}

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){
		   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 studentfeed(t,totradio,feedtype)
{
	if(feedtype==4 || feedtype==5)
	{
		if(t.sendername.value=="")
		{
			alert("Please specify name....");
			t.sendername.focus();
			return false;
		}
		if (chkselect(t.branchname,"Please specify branch...")==0)
			return 0;
		if (t.year.value=="")
		{
			alert("Please specify year of study....");
			t.year.focus();
			return false;
		}
		if (t.organisation.value=="")
		{
			alert("Please specify your Organisation Name....");
			t.organisation.focus();
			return false;
		}
		if (t.position.value=="")
		{
			alert("Please specify your current role/ position....");
			t.position.focus();
			return false;
		}
	}
	if(feedtype==2)
	{
		if(t.sendername.value=="")
		{
			alert("Please specify your name....");
			t.sendername.focus();
			return false;
		}
		if(t.wardname.value=="")
		{
			alert("Please specify your ward name studying in our College....");
			t.wardname.focus();
			return false;
		}
		if (chkselect(t.branchname,"Please specify your branch...")==0)
			return 0;
		if (t.year.value=="")
		{
			alert("Please specify your ward's year of study....");
			t.year.focus();
			return false;
		}
		if (chkselect(t.semester,"Please specify your Semester...")==0)
			return 0;
	}
	viewcount=0;
	unhappy=0;
	for(k=1;k<=totradio;k++)
	{
		radname1=eval("t.fq"+k+"[0].checked");
		radname2=eval("t.fq"+k+"[1].checked");
		radname3=eval("t.fq"+k+"[2].checked");
		if(radname1 || radname2 || radname3)
			viewcount++;
		if(radname3)
			unhappy++;
	}
	if(viewcount==0)
	{
		alert("Your feedback is important for us - Please specify your feedback for questions...");
		t.fq1[0].focus();
		return 0;
	}
	minview=parseInt(totradio/2);
	if(minview>viewcount)
	{
		alert("Please specify at least " + minview + " views to submit...");
		t.fq1[0].focus();
		return 0;
	}

	if(feedtype==5)
	{
		if(t.inputdetails7a.value=="" && t.inputdetails7b.value=="" && t.inputdetails7c.value=="")
		{
			alert("Please specify Input details for option...");
			t.inputdetails7a.focus();
			return false;
		}
	}
	if(feedtype==4)
	{
		if(t.inputdetails2a.value=="" && t.inputdetails2b.value=="" && t.inputdetails2c.value=="")
		{
			alert("Please specify Input details for option...");
			t.inputdetails2a.focus();
			return false;
		}
		if(t.inputdetails11a.value=="" && t.inputdetails11b.value=="" && t.inputdetails11c.value=="")
		{
			alert("Please specify Input details for option...");
			t.inputdetails11a.focus();
			return false;
		}
	}
	if(feedtype==1)
	{
		if(unhappy>0)
		{
			if(t.bug1view.value=="" && t.bug2view.value=="" && t.bug3view.value=="" && t.bug4view.value=="" && t.bug5view.value=="")
			{
				alert("Your comments/ critics are equally important for us - please take time to let us know the same so as to improve...");
				t.bug1view.focus();
				return false;
			}
		}
		if(t.sendername.value=="")
		{
			alert("Please specify your name... Specify your name as Student if you do not wish to disclose...");
			t.sendername.focus();
			return false;
		}
		if (chkselect(t.branchname,"Please specify your branch...")==0)
			return 0;
		if (chkselect(t.semester,"Please specify your Semester...")==0)
			return 0;
	}
	if(feedtype==3)
	{
		if(t.sendername.value=="")
		{
			alert("Please specify your name... Specify your name as Faculty if you do not wish to disclose...");
			t.sendername.focus();
			return false;
		}
		if (chkselect(t.branchname,"Please specify your Department...")==0)
			return 0;
	}
	if(t.strCAPTCHA.value=="")
	{
		alert("Please specify capture code shown above - Used for automated forms submission controls...");
		t.strCAPTCHA.focus();
		return false;
	}
	t.submit();
	return true;
}

//Blank textfield validation
function chkblank(t,msg)
{
	if (t.value=="")
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

//validation for selection list
function chkselect(t,msg)
{
	selno = t.selectedIndex; 
	
	selvalue = t.options[selno].value; 
	if (selvalue==0)
	{
		alert(msg);
		t.focus();
		return 0;
	}
	return true;
}

function chkradio(r,msg)
{
myOption = -1;
	
	for (i=r.length-1; i > -1; i--) {
	if (r[i].checked) {
		myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert(msg);
	return 0;
	}
}

//validation for phone/mobile
function phnocheck(input)
{
	var str = input.value;
	if (str!="")
	{
		for (var i = 0; i < str.length; i++) 
		{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return false;
	    	}
		}
	}
	return true;
}

function mobcheck(input)
{
	var str = input.value;
	if (str.length!=10)
	{
		alert("Invalid Phone number...");
		input.focus();
	    return false;
	}
	if (str.substring(1,0)!="9" && str.substring(1,0)!="8")
	{
		alert("Invalid Phone number...");
		input.focus();
	    return false;
	}
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if (ch < "0" || "9" < ch) 
			{
			input.value=""
        	alert("Invalid Phone number...");
			input.focus();
		    return false;
	    	}
	}
	return true;
}

function CheckNumber(input)
{
	var str = input.value;
	for (var i = 0; i < str.length; i++) 
	{
        	var ch = str.substring(i, i + 1)
	        if ((ch < "0" || "9" < ch) && ch != '.'  && ch!=",") 
			{
       	      	alert("Please Enter Numeric Value...");
				input.focus();
		        return false;
	    	}
	}
	return true;
}

