// JavaScript Document
var global,gandc;
global=2;
gandc=2;
function getpage(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=moviemasala&getpage="+element[selectedIndex].value;
	}
function getvideo(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=video&getvideo="+element[selectedIndex].value;
	}
function getnews(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=bottomnews&getnews="+element[selectedIndex].value;
	}
function getmain(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=main&getmain="+element[selectedIndex].value;
	}
function getsunshine(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=sunshine&getsunshine="+element[selectedIndex].value;
	}
function getcity123(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?getcity123="+element[selectedIndex].value;
	}
function showadmincity(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=uttra&showadmincity="+element[selectedIndex].value;
	}
function shownews123(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?shownews123="+element[selectedIndex].value;
	}
function getstate(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=uttra&getstate="+element[selectedIndex].value;
}

function meuseumpage(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=meuseum&getpage="+element[selectedIndex].value;
}
function universitypage(element){
	selectedIndex=element.selectedIndex;
	document.location="index.php?page=university&getpage="+element[selectedIndex].value;
}
function selectoffice(element){
	selectedIndex=element.selectedIndex;
	if(selectedIndex==0){
	document.getElementById("institue").disabled=true;
	document.getElementById("directorate").disabled=true;	
	}
	if(selectedIndex==1){
	document.getElementById("institue").disabled=false;
	document.getElementById("directorate").disabled=true;	
	}
	if(selectedIndex==2){
	document.getElementById("institue").disabled=true;
	document.getElementById("directorate").disabled=false;	
	}	
	
}

function addcoverstory(){
	document.location="index.php?page=coverstory";
}
function adduttra(){
	document.location="index.php?page=uttra";
}
function addnews(){
	document.location="index.php?page=news";
}
function addcategory(){
	document.location="index.php?page=gallery&mode=addcategory";
}

function addcontact(){
	document.location="index.php?page=telephone&mode=addcontact";
}
function newadd(){
	document.location="index.php?page=advertise";
}

function vfalidateuser(form){
	var errors=false;
	var msg="";
	if(form.username.value=="")
	{
		msg="Please enter a username.\n";
		errors=true;
	}
	if(form.pwd.value=="")
	{
		msg+="Please enter a password\n";
		errors=true;
	}
	if(form.pwd.value!=form.pwd2.value)
	{
		msg+="Password did not Match\n";
		errors=true;
	}
	if(form.name.value=="")
	{
		msg+="Please enter name.";
		errors=true;
	}
	if(errors){
		alert(msg);
		return false;
	}
	else
	{
		return true;
	}
}
function changepass(form){
	var errors=false;
	var msg="";
	if(form.oldpass.value==""){
		errors=true;
		msg="Please Enter the current Password\n";
		}
	if(form.pwd.value==""){
		errors=true;
		msg+="Please Enter the Password \n";
	}
	if(form.pwd.value!=form.pwd2.value)
	{
		msg+="Password did not Match\n";
		errors=true;
	}
	if(errors){
		alert(msg);
		return false;
	}
	else{
		return true;
	}
}
	
function addcontactdetails(form){
	var errors=false;
	var msg="";
	if(form.name.value==""){
		errors=true;
		msg="Please Enter Name\n";
	}	
	if(form.designation2.value==""){
		errors=true;
		msg+="Please Enter Designation\n";
	}
	if(form.Officename2.value==""){
		errors=true;
		msg+="Please Enter Office Name\n";
	}
	if(form.Officename2.value==""){
		errors=true;
		msg+="Please Enter Office Name\n";
	}
	if(errors){
		alert(msg);
		return false;
	}
	else
	{
		return true;
	}
}
function addgandc(button,links){
	button.style.display="none";
	var addnew='';
	addnew+='<table width="100%">';
    addnew+='<tr class="tr1">';
    addnew+='<td width="29%">Link Title</td>';
    addnew+='<td width="1%">:</td>';
    addnew+='<td width="70%"><input class="textbox" type="text" name="link[]" value="">';
    addnew+='<span class="style1">*</span></td>';
  	addnew+='</tr>';
  	addnew+='<tr class="tr2">';
    addnew+='<td>Link File(.doc,.pdf,jpeg,xls)</td>';
    addnew+='<td>:</td>';
    addnew+='<td><input type="file" class="textbox" name="linkfile[]" value="">';
    addnew+='<span class="style1">*';
    addnew+='<input type="submit" name="button2"  value="   +   " onclick="addgandc(this,\'gandc\')" />';
    addnew+='</span></td>';
 	addnew+='</tr>';
    addnew+='</table>';
	if(gandc<8)
	document.getElementById(links).innerHTML+=addnew;
	else
	alert("More links cannot be added at this time......");
	gandc++;
}

function clone(button){
	ele="pressdata"+global;
	var clone;
	button.style.display="none";
	clone=document.getElementById(ele);
	var data;
	data='<table width="100%" cellspacing="1" border="0">';
    data+='<tr class="tr2">';
    data+='<td width="29%">Link Newspaper Name</td>';
    data+='<td width="1%">:</td>';
    data+='<td width="70%"><span class="style1">';
    data+='<input class="textbox" type="text" name="newspaper[]" value="" id="newspaper[]">';
    data+='*</span></td>';
    data+='</tr>';
    data+='<tr class="tr2">';
    data+='<td>Date</td>';
    data+='<td>:</td>';
    data+='<td><span class="style1">';
    data+='<input class="textbox" type="text" name="date[]" value="" id="tdate[]">';
    data+='*</span></td>';
    data+='</tr>';
    data+='<tr class="tr2">';
    data+='<td>Link File(.doc,.pdf,jpeg,xls)</td>';
    data+='<td>:</td>';
    data+='<td><input type="file" class="textbox" name="linkfile[]" value="" id="linkfile[]">';
    data+='<span class="style1">*';
    data+='<input type="button" name="button2" id="button2" value="   +   " onClick="clone(this)">';
    data+='</span></td>';
    data+='</tr>';
    data+='</table>';
	if(global<=3)
	clone.innerHTML+=data;
	else
	alert('Only three links can be added at this time');
	global++;
}