//Variable declaration
var msg,programName,width,HEIGHT;
var	songStr,sname,code,pvdid,vdid;
var mUrl,img,title,path;

//function for topnavi to show msg on mouse over
function setStatus(msg){
status = msg;
return true;
 }
//function for search 
function searchlink()
{
if (document.frmSearch.k1.value == "")
{
	alert("Fill the input box");
}
else{
	k1=document.frmSearch.k1.value;

if(document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 1)
{url='/cgi-bin/web/search.pl?&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 2)
{url='/cgi-bin/web/ringsearch.pl?&sv=1&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 3)
{url='/cgi-bin/web/picsearch.pl?&sv=2&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 4)
{url='/cgi-bin/web/picsearch.pl?&sv=3&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 5)
{url='/cgi-bin/web/ringsearch.pl?&sv=4&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 6)
{url='/cgi-bin/web/picsearch.pl?&sv=5&keyword=';
url = url+k1;
location.href=url;
}
if (document.frmSearch.selectsrch.options[document.frmSearch.selectsrch.selectedIndex].value == 7)
{url='/cgi-bin/web/ringsearch.pl?&sv=8&keyword=';
url = url+k1;
location.href=url;
}
}
}
//function for truetone	ringtone popup
function showTTone(songStr) {
	mToneUrl = '/cgi-bin/web/showttone.pl?' + songStr;
	mToneWin = window.open(mToneUrl,'getToneWin','width=531,height=240,status=no,menubar=no,resizable=no,scrollbars=yes');
}
//function for simple popup 
function javapop(programName,width,HEIGHT)
{
var temp ="toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width="+width+",HEIGHT="+HEIGHT;
displayWindow=window.open(programName,"displayWindow",temp) ;
}
//function for polyphonic ringtone popup
function javascrhtune(sname,code,pvdid,vdid)
{
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("msie") != -1) {
var tmptune ="toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width=541,height=270";
}
else {
var tmptune ="toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width=541,height=270";
}
displayWindow=window.open("/cgi-bin/poly/ringpopup.pl?sname="+sname+"&code="+code+"&vpdid="+pvdid+"&vdid="+vdid+"&img=no","displayWindow",tmptune) ;
return;
}
//function for Monophonic ringtone popup
function showTone(songStr) {
	mToneUrl = '/cgi-bin/ringtone/ringpop.pl?' + songStr + '&img=no';
	mToneWin = window.open(mToneUrl,'getToneWin','width=520,height=430,status=no,menubar=no,resizable=no,scrollbars=no');
}
//function for popup where pages should open in parent page
function showLink(mUrl) {
 opener.parent.location.href = mUrl;
 window.close();
}
//mouse out function for logo
function logoRestore(){
document.logo.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for logo
function logoMap(img,code,title) {
var path="http://im.rediff.com/uim/mobile/logo/";
document.logo.src = path+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for wallpaper
function wallRestore(){
document.wallpaper.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for wallpaper
function wallMap(img,code,title,st) {
var path1="http://im.rediff.com/uim/mobile/wallpaper/";
if (st==1){
	path1="";
}

document.wallpaper.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for picture message
function picRestore(){
document.picture.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for picture message
function picMap(img,code,title) {
var path2="http://im.rediff.com/uim/mobile/pictures/";
document.picture.src = path2+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for JavaGames
function jgamesRestore(){
document.javagames.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for JavaGames
function  jgamesMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/";
document.javagames.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse over function for JavaApplication
function  jappMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/";
document.javaapp.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for JavaApplication
function jappRestore(){
document.javaapp.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//for flirt
function article(programName,width,height)
{
	var temp = "menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no,width="+width+",height="+height;
	displayWindow=window.open(programName,"displayWindow",temp) ;
}
function pop(strurl) {
 	window.open(strurl,"rediff","toolbars=no,directory=no,scrolling=yes,scrollbars=yes,maximize=null,width=420,height=400");}

function fixSelect(tVal, vVal, url) {
	if (!pause) {
		document.write("<hidden value=url>"+url+"<option value="+vVal+">"+tVal); //update select
	}
	else {
		//repopulate
		var gr = document.frmSearch.modelList ;
        //var valOption = new Option(tVal);
        //gr.options[valLen] = valOption;
        var valLen = gr.length;
        var valOption = new Option();
        valOption.text = tVal;
        valOption.value = vVal;
        gr.options[valLen] = valOption;
        //gr.Add(valOption);
    }
}
function InitOptions(make1) {
		
		if(make1 == "Nokia") {
						fixSelect("Nokia 1100","1100|");
						fixSelect("Nokia 2100","2100|");
				  		fixSelect("Nokia 2300","2300|");
						fixSelect("Nokia 2600","2600|");
						fixSelect("Nokia 2650","2650|http://nds.nokia.com/uaprof/N2650r100.xml");
						fixSelect("Nokia 3100","3100|http://nds.nokia.com/uaprof/N3100r100.xml");
						fixSelect("Nokia 3105","3105|http://nds.nokia.com/uaprof/N3105tlsr100.xml");
						fixSelect("Nokia 3200","3200|http://nds1.nds.nokia.com/uaprof/N3200r100.xml");
						fixSelect("Nokia 3220","3220|http://nds1.nds.nokia.com/uaprof/N3220r100.xml");
						fixSelect("Nokia 3230","3230|http://nds1.nds.nokia.com/uaprof/N3230r100.xml");
						fixSelect("Nokia 3300","3300|http://nds.nokia.com/uaprof/N3300r100.xml");
						fixSelect("Nokia 3310","3310|");
						fixSelect("Nokia 3330","3330|");
						fixSelect("Nokia 3410","3410|http://nds.nokia.com/uaprof/N3410r100.xml");
						fixSelect("Nokia 3510","3510|http://nds1.nds.nokia.com/uaprof/N3510r100.xml");
						fixSelect("Nokia 3510i","3510i|http://nds1.nds.nokia.com/uaprof/N3510ir100.xml");
						fixSelect("Nokia 3650","3650|");
						fixSelect("Nokia 3660","3660|");
						fixSelect("Nokia 5100","5100|http://nds.nokia.com/uaprof/N5100r100.xml");
						fixSelect("Nokia 5140","5140|http://nds1.nds.nokia.com/uaprof/N5140r100.xml");
						fixSelect("Nokia 5210","5210|http://nds.nokia.com/uaprof/N5210r100.xml");
						fixSelect("Nokia 6020","6020|http://nds1.nds.nokia.com/uaprof/N6020r100.xml");
						fixSelect("Nokia 6100","6100|http://nds.nokia.com/uaprof/N6100r100.xml");
						fixSelect("Nokia 6170","6170|");
						fixSelect("Nokia 6200","6200|http://nds1.nds.nokia.com/uaprof/N6200r100.xml");
						fixSelect("Nokia 6210","6210|http://nds.nokia.com/uaprof/N6210r100.xml");
						fixSelect("Nokia 6220","6220|http://nds1.nds.nokia.com/uaprof/N6220r300.xml");
						fixSelect("Nokia 6230","6230|http://nds1.nds.nokia.com/uaprof/N6230r200.xml");
						fixSelect("Nokia 6250","6250|http://nds.nokia.com/uaprof/N6250r100.xml");
						fixSelect("Nokia 6260","6260|http://nds1.nds.nokia.com/uaprof/N6260r100.xml");
					//	fixSelect("Nokia 6310i","6310i|http://nds.nokia.com/uaprof/N6310r100.xml");
						fixSelect("Nokia 6510","6510|http://nds.nokia.com/uaprof/N6510r100.xml");
						fixSelect("Nokia 6600","6600|http://nds1.nds.nokia.com/uaprof/N6600r100.xml");
						fixSelect("Nokia 6610","6610|http://nds.nokia.com/uaprof/N6610r100.xml");
						fixSelect("Nokia 6610i","6610i|http://nds1.nds.nokia.com/uaprof/N6610ir100.xml");
						fixSelect("Nokia 6620","6620|");
						fixSelect("Nokia 6630","6630|http://nds1.nds.nokia.com/uaprof/N6630r100.xml");
						fixSelect("Nokia 6650","6650|");
						fixSelect("Nokia 6670","6670|");
						fixSelect("Nokia 6800","6800|http://nds.nokia.com/uaprof/N6800r100.xml");
						fixSelect("Nokia 6810","6810|http://nds1.nds.nokia.com/uaprof/N6810r100.xml");
						fixSelect("Nokia 6820","6820|http://nds1.nds.nokia.com/uaprof/N6820r100.xml");
						fixSelect("Nokia 7210","7210|http://nds1.nds.nokia.com/uaprof/N7210r100.xml");
						fixSelect("Nokia 7250","7250|http://nds1.nds.nokia.com/uaprof/N7250r100.xml");
						fixSelect("Nokia 7250i","7250i|http://nds1.nds.nokia.com/uaprof/N7250ir100.xml");
						fixSelect("Nokia 7260","7260|http://nds1.nds.nokia.com/uaprof/N7260r100.xml");
						fixSelect("Nokia 7270","7270|http://nds1.nds.nokia.com/uaprof/N7270r100.xml");
						fixSelect("Nokia 7600","7600|http://nds1.nds.nokia.com/uaprof/N7600r100.xml");
						fixSelect("Nokia 7610","7610|http://nds.nokia.com/uaprof/N7610r100.xml");
						fixSelect("Nokia 7650","7650|");
						fixSelect("Nokia 8310","8310|http://nds.nokia.com/uaprof/N8310r100.xml");
						fixSelect("Nokia 8910i","8910i|http://nds.nokia.com/uaprof/N8910ir100.xml");
					    fixSelect("Nokia 9110","9110|");
						fixSelect("Nokia 9210","9210|");
						fixSelect("Nokia 9300","9300|");
						fixSelect("Nokia 9500","9500|");
						fixSelect("Nokia 9110i","9110i|http://nds1.nds.nokia.com/uaprof/N9110r100.xml");
						fixSelect("Nokia 9210i","9210i|http://nds1.nds.nokia.com/uaprof/N9210r100.xml");
						fixSelect("Nokia 9300","9300|http://nds1.nds.nokia.com/uaprof/N9300r100.xml");
						fixSelect("Nokia N-GAGE","N-GAGE|http://nds1.nds.nokia.com/uaprof/NNGager100.xml");
						fixSelect("Nokia N-Gage QD","ngage-qd|http://nds1.nds.nokia.com/uaprof/NNGageQDr100.xml");
			}
	
		if(make1 == "Siemens") {
				
						fixSelect("Siemens CF62","CF62|http://communication-market.siemens.de/UAProf/CF62_84.xml");
						fixSelect("Siemens C65","C65|http://communication-market.siemens.de/portal/UAProf/UAP.aspx?device=C65&v=25");
						fixSelect("Siemens SL65","SL65|http://communication-market.siemens.de/portal/UAProf/UAP.aspx?device=SL65&v=16");
								}
		if(make1 == "Sony Ericsson") {
				
						fixSelect("Sony Ericsson K500i","K500i|");
						fixSelect("Sony Ericsson K600i","K600i|");
						fixSelect("Sony Ericsson K700i","K700i|http://wap.sonyericsson.com/UAprof/K700iR101.xml");
						fixSelect("Sony Ericsson T630","T630|");
						fixSelect("Sony Ericsson T610","T610|");
						fixSelect("Sony Ericsson Z1010","Z1010|http://wap.sonyericsson.com/UAprof/Z1010R101.xml");
						fixSelect("Sony Ericsson Z200","Z200|");
					
													
			}
		if (make1 == "Select") {
						fixSelect("Phone Model", "Select")
	}
}

function reInitOptions() {
    var val = document.frmSearch.makeList;
    var gr = document.frmSearch.modelList;
    make1 = val.options[val.selectedIndex].value;

    for (i = gr.length; i>0; i--) {
		gr.options[0] = null ;
    }
    pause = true;
    InitOptions(make1);
    gr.options[0].selected = true;
    return false;
}
// searching wallpaper only
function searchwall()
{
	if (document.frmSearch1.k2.value == "")
	{		alert("Fill the input box");   }
	else{
		k2=document.frmSearch1.k2.value;
		//alert(k2);
		url='/cgi-bin/web/picsearch.pl?&sv=5&keyword=';
		url = url+k2;
		location.href=url;
			}     
}

function searchpic()
 {		
	 if (document.frmSearch2.k3.value == "")
	{		alert("Fill the input box");   }
	else{
		k3=document.frmSearch2.k3.value;
		//alert(k2);
		url='/cgi-bin/web/picsearch.pl?&sv=3&keyword=';
		url = url+k3;
		location.href=url;
			}     
}

function searchlogo()
 {		
	 if (document.frmSearch2.k4.value == "")
	{		alert("Fill the input box");   }
	else{
		k4=document.frmSearch2.k4.value;
		//alert(k2);
		url='/cgi-bin/web/picsearch.pl?&sv=2&keyword=';
		url = url+k4;
		location.href=url;
			}     
}
function searchmono()
 {		
	 if (document.frmSearch2.k2.value == "")
	{		alert("Fill the input box");   }
	else{
		k2=document.frmSearch2.k2.value;
		//alert(k2);
		url='/cgi-bin/web/ringsearch.pl?&sv=1&keyword=';
		url = url+k2;
		location.href=url;
			}     
}
function searchpoly()
 {		
	 if (document.frmSearch2.k2.value == "")
	{		alert("Fill the input box");   }
	else{
		k2=document.frmSearch2.k2.value;
		//alert(k2);
		url='/cgi-bin/web/ringsearch.pl?&sv=4&keyword=';
		url = url+k2;
		location.href=url;
			}     
}
function searchsongt()
 {		
	 if (document.frmSearch2.k2.value == "")
	{		alert("Fill the input box");   }
	else{
		k2=document.frmSearch2.k2.value;
		//alert(k2);
		url='/cgi-bin/web/ringsearch.pl?&sv=8&keyword=';
		url = url+k2;
		location.href=url;
			}     
}

//mouse out function for animation
function animRestore(){
document.animation.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for animation
function animMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/animations/";
document.animation.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}

//mouse out function for Themes
function themeRestore(){
document.themes.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for Themes
function themeMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/themes/";
document.themes.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for clogo
function clogoRestore(){
document.collogo.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for clogo
function clogoMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/clogos/";
document.collogo.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}
//mouse out function for Videos
function videoRestore(){
document.video.src = "http://im.rediff.com/uim/mobile/trans.gif";
Code.innerText="CODE";
Title.innerText="";
}
//mouse over function for Videos
function videoMap(img,code,title) {
var path1="http://im.rediff.com/uim/mobile/video/";
document.video.src = path1+img;
Code.innerText=code;
Title.innerText=title;
}

