﻿var selectedAnchorMenuItemColorName;
var selectedDivMenuItemClassName;
function expandLogin()
{document.getElementById('Expanded').style.display="block";}
function changeHomeBg()
{if((document.title == "AMG-Home") || (document.title == "AMG - Home"))
{document.getElementById('innerBody').className = "innerHomebody ";
GoHome}}
function GetLang()
{var i = 0;var fileName = "";var lang = "";var cssFiles = document.getElementsByTagName('link');
for(i=0; i<cssFiles.length; i++)
{fileName = cssFiles[i].href;
if(fileName.indexOf('Band.css') != -1)
{lang = "English";break;}
if(fileName.indexOf('BandAr.css') != -1)
{lang = "Arabic";break;}
}return lang;}
function WriteCSS()
{var objScript = window.document.createElement('link'); 
objScript.text = "function showText(){alert('I am still working! WHY?');}" 
objScript.rel = 'stylesheet'; objScript.type = 'text/css'; 
objScript.href = '/Style%20Library/en-us/Core%20Styles/Band.css';
var objHead = window.document.getElementsByTagName('head')[0];objHead.appendChild(objScript);}
function CheckLanguage()
{var lang = GetLang();
if(lang == "Arabic")
{try
{document.getElementById('lnkLogout').innerHTML = 'خروج';
document.getElementById('lnkLogout').href = '/Arabic/Pages/SignOut.aspx';
document.getElementById('lnkUpdate').innerHTML = 'حسابي';
document.getElementById('lnkUpdate').href = '/Arabic/members/pages/updateprofile.aspx';}
catch(ex)
{}
try
{document.getElementById('lnkLogin').innerHTML = 'دخول';
document.getElementById('lnkLogin').href = '/_layouts/Authenticate.aspx?source=' + document.location.pathname;
document.getElementById('lnkRegister').innerHTML = 'اشتراك';
document.getElementById('lnkRegister').href = '/Arabic/accounts/Pages/Register.aspx';}
catch(ex){}
document.getElementById('footerclassid').className = 'footerclass';
document.getElementById('footer1').innerHTML = '© AMG 2007 - جميع الحقوق محفوظة - تم التطوير بواسطة <a class="footerlink" href="http://www.link.net">Link Development</a>';
document.getElementById('feedback').innerHTML = 'رأيك يهمنا';
document.getElementById('feedback').href = '/Arabic/Pages/Feedback.aspx';
document.getElementById('sitemap').innerHTML ='خريطة الموقع';
document.getElementById('sitemap').href = '/Arabic/Pages/sitemap.aspx';
document.getElementById('PrivacyStatementLink').innerHTML ='سياسة السرية';
document.getElementById('PrivacyStatementLink').href = "/Arabic/Pages/privacypolicy.aspx";
try{document.getElementById("NavImg").src = "/Style Library/AMGImages/RightNav_BG.jpg";}
catch (e) { }}
else
{try
{document.getElementById('lnkLogout').innerHTML = 'Log Out';					
document.getElementById('lnkLogout').href = '/English/Pages/SignOut.aspx';
document.getElementById('lnkUpdate').innerHTML = 'Update profile';
document.getElementById('lnkUpdate').href = '/English/members/pages/updateprofile.aspx';}
catch(ex){}
try{document.getElementById('lnkLogin').innerHTML = 'Login';
document.getElementById('lnkLogin').href = '/_layouts/Authenticate.aspx?source=' + document.location.pathname;
document.getElementById('lnkRegister').innerHTML = 'Register';
document.getElementById('lnkRegister').href = '/English/accounts/Pages/Register.aspx';}
catch(ex){}
document.getElementById('footer1').innerHTML = '© AMG. All Rights Reserved. Developed by <a href="http://www.linkdev.com" target="_blank" class="footerlink">Link Development</a>, a <a href="http://www.link.net" target="_blank" class="footerlink">LINKdotNET</a> subsidiary.';
document.getElementById('feedback').innerHTML = 'Feedback';
document.getElementById('feedback').href = '/English/Pages/Feedback.aspx'
document.getElementById('sitemap').innerHTML = 'Sitemap'
document.getElementById('sitemap').href = '/English/Pages/sitemap.aspx';
try{document.getElementById("NavImg").src = "/Style Library/AMGImages/LeftNav_BG.jpg";}
catch (e) {}}}
function GoHome()
{if((document.title == "AMG-Home") || (document.title == "AMG - Home"))
{return;}
else{
var lang = GetLang();
if(lang == "English"){document.location.href = '/English/pages/default.aspx';}
else{document.location.href = '/Arabic/pages/default.aspx';}}} 
function LanguageLinkAdjust() 
{var englishVal = "/English/";
var arabicVal = "/Arabic/"; 
if(document.location.href.toLowerCase().indexOf(englishVal) != -1)
{document.getElementById('LanguageLink').innerHTML='<img src="/Style Library/AMGImages/langAr.jpg" alt="Go to Arabic version" border="0" />';
document.getElementById('LanguageLink').href = document.location.href.toLowerCase().replace(englishVal,arabicVal);}
else if(document.location.href.toLowerCase().indexOf(arabicVal) != -1)
{document.getElementById('LanguageLink').innerHTML="<img src='/Style Library/AMGImages/langEn.jpg' alt='Go to English version' border='0' />";
document.getElementById('LanguageLink').href = document.location.href.toLowerCase().replace(arabicVal,englishVal)}
else{document.getElementById('LanguageLink').style.display="none";} 
if(document.location.href.toLowerCase().indexOf("/newsdetails.aspx") != -1)
{document.getElementById('LanguageLink').href = document.getElementById('LanguageLink').href.replace("/newsdetails.aspx","/Default.aspx").split("?")[0];}
if(document.location.href.toLowerCase().indexOf("/eventdetails.aspx") != -1)
{document.getElementById('LanguageLink').href = document.getElementById('LanguageLink').href.replace("/eventdetails.aspx","/Default.aspx").split("?")[0];}}  
function GoDetails(lnk)
{var eventId = lnk.parentNode.parentNode.parentNode.childNodes[0].childNodes[2].innerHTML;
document.open("EventDetails.aspx?eventId="+eventId ,"_self","","");}
function ShowDetails(td)
{var eventId = td.parentNode.parentNode.lastChild.lastChild.innerHTML;
document.open("EventDetails.aspx?eventId="+eventId ,"_self","","");}
function SetDetails(table)
{var eventId = table.lastChild.lastChild.lastChild.innerHTML;
document.open("EventDetails.aspx?eventId="+eventId ,"_self","","");}
function GetMonthName(num)
{try{
var lang = GetLang();
if(lang == "Arabic")
{MonthsNames = new Array('يناير','فبراير','مارس','ابريل','مايو','يونيو','يوليو','اغسطس','سبتمبر','اكتوبر','نوفمبر','ديسمبر');}
else{MonthsNames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');}
var i = num - 1;
var monthName = MonthsNames[i];
return monthName;}
catch(ex)
{alert(ex.message);}}
function GetMonthNameByDate(num)
{try
{var lang = GetLang();
if(lang == "Arabic")
{MonthsNames = new Array('يناير','فبراير','مارس','ابريل','مايو','يونيو','يوليو','اغسطس','سبتمبر','اكتوبر','نوفمبر','ديسمبر');}
else{MonthsNames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');}
var i = num.split('/')[0] - 1;
var monthName = MonthsNames[i];
return monthName;}
catch(ex)
{alert(ex.message);}}
function GetMonthNum(monthName){
MonthsNames1 = new Array("يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر");
var monthNum = 0;
var i = 0;
for(i=0;i<MonthsNames1.length;i++)
{if(MonthsNames1[i] == monthName)
{monthNum = i+1;
break;}}
return monthNum;}
function FilterEvents()
{var month = document.getElementById("ddlMonths").selectedIndex;
var selectedText = document.getElementById("ddlMonths").options[month].text;
var y = document.getElementById("ddlYears").selectedIndex;
var year = document.getElementById("ddlYears").options[y].text;	
if((selectedText != '') && (year != '')) //user already chosed
{var monthNum = GetMonthNum(selectedText);var strMonth = monthNum + '';
if(strMonth.length == 1)
{strMonth = "0" + strMonth;}
var oldUrl = document.location.href;
originalUrl = CheckUrl(oldUrl);
newUrl = originalUrl+"?month="+strMonth+"&&year="+year;
window.open(newUrl,'_self');}
else{window.alert(' ..    ');}}
function CheckUrl(oldUrl)
{oldUrl = document.location.href;
var i = oldUrl.indexOf('?');
if(i != -1) 
{oldUrl = oldUrl.substring(0, i);}
return oldUrl;}
function SaveYear()
{var list = document.getElementById('ddlYears');
 var i = list.selectedIndex;
 var year = list.options[i].text;
 var oldUrl = document.location.href;
 originalUrl = CheckUrl(oldUrl);
 newUrl = originalUrl+"?yearList="+year;
 window.location.href = newUrl;}
function ChangeBg(table){table.className="EventListHover";}
function ReloadBg(table){table.className="EventList";}
function  HideThis(cont)
{document.getElementById(cont).style.display="none";document.getElementById(cont).style.visibility="hidden";}
  function Search_onclick() {
 
 if (Search_validator()){ 
 var str=document.location.href.toLowerCase();
var  lang= str.indexOf("arabic");

     
 
 txtSearch=document.getElementById("txtSearch");		
 if(lang >= 0)
{
 window.location.href="/Arabic/Search/Results.aspx?k=" +encodeURIComponent( txtSearch.value);}
 else{window.location.href="/English/Search/Results.aspx?k=" + encodeURIComponent(txtSearch.value);
 }}}
function Search_onkeypress(event1) 
{var kCode = String.fromCharCode(event1.keyCode);
 if(kCode == "\n" || kCode == "\r")
{Search_onclick();}}


 function Search_validator()
    {
        txtSearch=document.getElementById("txtSearch");
         var k=txtSearch.value;
         
       k= k.replace( /\s*$/, '' );
        var regEx=/[`'~@#$%\^&\*{}\>\<()=+:;\[\]\\|]+/;
  		 var regExR=/[`'~@#$%\^&\*{}\>\<()=+:;\[\]\\|]+/;
        if (k != "")
        {
        	if(!regEx.test(k))
        	{
        	  hidediv("SearchValidatorDiv");
            	return true;
        	}
        	else
        	{
        	showdiv("SearchValidatorDiv");
            
            var str=document.location.href.toLowerCase();
			var  lang= str.indexOf("/english/");
			if(lang < 0)
			{           
			  alert("من فضلك ضع كلمة البحث بشكل صحيح");
			}
			else {
			 alert("Enter search valid words");
			 }
          //  alert(SearchValidatorDiv);
          	SwitchDiv('divtxtSearch',false);
			SwitchDiv('divtxtSearchMain',true);

            document.getElementById("divtxtSearchOver").focus();
            return false;

        	
        	}
        	
        	
          
        }
        else
        {
        	
            showdiv("SearchValidatorDiv");
            
            var str=document.location.href.toLowerCase();
			var  lang= str.indexOf("/english/");
			if(lang < 0)
			{           
			  alert("من فضلك ضع كلمة البحث");
			}
			else {
			 alert("Enter search words");
			 }
          //  alert(SearchValidatorDiv);
          	SwitchDiv('divtxtSearch',false);
			SwitchDiv('divtxtSearchMain',true);

            document.getElementById("divtxtSearchOver").focus();
            return false;
        }
    }
    
/*
function Search_validator()
{txtSearch=document.getElementById("txtSearch");
if (txtSearch.value != "")
{return true;}
else{alert("Enter search words");document.getElementById("divtxtSearchOver").focus();
return false;}}

*/
function Search_TextAdjustment() 
{try{
var lang = GetLang();                	
if(lang == "Arabic")
{txtSearch=document.getElementById("txtSearch");divtxtSearchOver=document.getElementById("divtxtSearchOver");
Imgsearch=document.getElementById("Imgsearch");							
document.getElementById("SearchValidatorDiv").innerText="من فضلك ضع كلمة البحث";					
divtxtSearchOver.title="ادخل كلمة بحث واحدة او اكثر";
txtSearch.title="ادخل كلمة بحث واحدة او اكثر";	
divtxtSearchOver.value=" بحث";	
Imgsearch.title="أبحث";}}
catch(ex)
{alert(ex);}}

function getObj(name)
{if (document.getElementById)
{this.obj = document.getElementById(name);this.style = document.getElementById(name).style;}
else if (document.all)
{this.obj = document.all[name];this.style = document.all[name].style;}
else if (document.layers){this.obj = document.layers[name];this.style = document.layers[name];}}
function SelectRightMenuElementPage(pageName)
{try{
vari=0
for(i=0;i<20;i++){
currentTD =document.getElementById("zz2_CurrentNavn" + i);
pagename=(currentTD.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].href.split("/Pages/")[1]).toLowerCase();			
if(pagename.toLowerCase() == pageName.toLowerCase())
{currentTD.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].className="zz2_CurrentNav_1 leftNav2 zz2_CurrentNav_8 leftNavSelected zz2_CurrentNav_12";  //<a				
currentTD.childNodes[0].childNodes[0].className="leftNav2 zz2_CurrentNav_9 leftNavSelected zz2_CurrentNav_13";  //table
}}}
catch(ex)
{}}
function WebURLEncode(textValue)
{var SAFECHARS = "0123456789" +                             
 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
 "abcdefghijklmnopqrstuvwxyz" +
 "-_.!~*'()";
 var HEX = "0123456789ABCDEF";
 var plaintext = textValue;
 var encoded = "";
 for (var i = 0; i < plaintext.length; i++ ) {
 var ch = plaintext.charAt(i);
 if (ch == " ") {
 encoded += "+";                   
 } else if (SAFECHARS.indexOf(ch) != -1) {
 encoded += ch;
 } else {
 var charCode = ch.charCodeAt(0);
 if (charCode > 255) {
 alert( "Unicode Character '" 
 + ch 
 + "' cannot be encoded using standard URL encoding.\n" +
 "(URL encoding only supports 8-bit characters.)\n" +
 "A space (+) will be substituted." );
 encoded += "+";
 } else {
 encoded += "%";
 encoded += HEX.charAt((charCode >> 4) & 0xF);
 encoded += HEX.charAt(charCode & 0xF);
 }}} 
return encoded;}
function WebURLDecode(textValue)
{var HEXCHARS = "0123456789ABCDEFabcdef"; 
var encoded = textValue;
var plaintext = "";
var i = 0;
while (i < encoded.length) {
var ch = encoded.charAt(i);
if (ch == "+") {
plaintext += " ";
i++;
} else if (ch == "%") {
if (i < (encoded.length-2) 
&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
plaintext += unescape( encoded.substr(i,3) );
i += 3;} 
else {alert( 'Bad escape combination near ...' + encoded.substr(i) );
plaintext += "%[ERROR]";
i++;}}
else{plaintext += ch;
i++;
}} return plaintext;}
function getUrl(movieUrl)
{movieUrl =  movieUrl.substring(movieUrl.indexOf('=')+2,movieUrl.length);
movieUrl = escape(unescape(movieUrl));
return movieUrl;}
function RunFlash(movieUrl,photo,DivID){
movieUrl = getUrl(movieUrl);
photo = '/'+getUrl(photo);
var flashboxwidth;
var flashboxheight;
var playername;
var vars;
if(DivID == "VideoFlashContent"){
flashboxheight='200';
flashboxwidth ='302';
playername='flvplayer';
var Section=location.pathname;
	if (Section.toLowerCase() == '/english/news/pages/newsdetails.aspx' || Section.toLowerCase() == '/arabic/news/pages/newsdetails.aspx' )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0x00FFFC&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/music/pages/musicdetails.aspx' || Section.toLowerCase() == '/arabic/music/pages/musicdetails.aspx' || Section.toLowerCase() == '/english/music/pages/musichome.aspx' || Section.toLowerCase() == '/arabic/music/pages/musichome.aspx' || Section.toLowerCase() == '/english/music/pages/videolist.aspx' || Section.toLowerCase() == '/arabic/music/pages/videolist.aspx')
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xFF4907&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/tv/pages/showsdetails.aspx' || Section.toLowerCase() == '/arabic/tv/pages/showsdetails.aspx' || Section.toLowerCase() == '/english/tv/pages/behinddetails.aspx' || Section.toLowerCase() == '/arabic/tv/pages/behinddetails.aspx' || Section.toLowerCase() == '/english/tv/pages/beonmtv.aspx'|| Section.toLowerCase() == '/arabic/tv/pages/beonmtv.aspx' || Section.toLowerCase() == '/english/tv/pages/waslatilist.aspx' || Section.toLowerCase() == '/arabic/tv/pages/waslatilist.aspx' || Section.toLowerCase() == '/english/tv/pages/episodevideodetails.aspx' || Section.toLowerCase() == '/arabic/tv/pages/episodevideodetails.aspx' )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0x2ccc24&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/prosocial/pages/newsdetails.aspx' || Section.toLowerCase() == '/arabic/prosocial/pages/newsdetails.aspx'  )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xe10000&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/insidemtva/pages/eventsdetails.aspx' || Section.toLowerCase() == '/arabic/insidemtva/pages/eventsdetails.aspx'  )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xc71583&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/music/pages/gigdetails.aspx' || Section.toLowerCase() == '/arabic/music/pages/gigdetails.aspx'  )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xcFF4907&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/mtvaart/pages/uploadsofweekvideos.aspx' || Section.toLowerCase() == '/arabic/mtvaart/pages/uploadsofweekvideos.aspx'  )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0x3374e1&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
else if (Section.toLowerCase() == '/english/music/pages/searchresults.aspx' || Section.toLowerCase() == '/arabic/music/pages/searchresults.aspx'  )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xFF4907&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
}
else if(DivID == "VideoFlashContent3")
{flashboxheight='200';
flashboxwidth ='302';
playername='flvplayer';
var Section=location.pathname;
if (Section.toLowerCase() == '/english/prosocial/pages/stories.aspx' || Section.toLowerCase() == '/arabic/prosocial/pages/stories.aspx' || Section.toLowerCase() == '/english/prosocial/pages/newsdetails.aspx' || Section.toLowerCase() == '/arabic/prosocial/pages/newsdetails.aspx'   )
vars='frontcolor=0x949494&bgcolor=0x949494&backcolor=0xe10000&lightcolor=0xFFFFFF&image='+ photo +'&file='+movieUrl;
}
else if ( DivID.indexOf("AudioFlashContent2") == 0 )
                {
                                flashboxheight='23';
                                flashboxwidth ='165';
                                playername='amgMTVaAudioPlayer11Dec08';
                                color = 'ffff03';
                                vars='colorIs='+color+'&musicPath='+movieUrl;
                }
                else
                {
                                color = 'ffff03';
                                flashboxheight='24';
                                flashboxwidth ='165';
                                playername='amgMTVaAudioPlayer11Dec08';
                                vars='colorIs='+color+'&musicPath='+movieUrl;
                }

/*else if(DivID == "AudioFlashContent2")
{flashboxheight='23';
flashboxwidth ='165';
playername='amgMTVaAudioPlayer11Dec08';}
else if(DivID == DivID){
color = 'ffff03';
flashboxheight='24';
flashboxwidth ='165';
playername='amgMTVaAudioPlayer11Dec08';
vars='colorIs='+color+'&musicPath='+movieUrl;}*/
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',
'width', flashboxwidth,
'height', flashboxheight,
'src', '/Style Library/Flash/'+playername,
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'top',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'VP2',
'name', 'VP2',
'menu', 'true',
'allowFullScreen', 'true',
'allowScriptAccess','sameDomain',
'movie', '/Style Library/Flash/'+playername,
'FlashVars',vars,
'salign', '' ,
'DivID' , DivID, 
'wmode' , 'opaque'
); 
}
var videoplayed=false;
function FV(furl,photo,title,text,id)
{if(!videoplayed)
{window.setTimeout('RunFlash("'+furl+'","'+photo+'","VideoFlashContent")',200);	;
videoplayed=true;
FVtext(title,text,id); 
}}
var audioplayed=false;
function AV(furl,photo)
{if(!audioplayed)
{RunFlash(furl,photo,"AudioFlashContent2");
audioplayed=true;}}
function FVtext(title,text,id){
document.getElementById('videoTitle').innerHTML=title;
if(document.all)
document.getElementById('videoText').innerText=text;
else
document.getElementById('videoText').textContent=text;
document.getElementById('curvideo'+id).className='videoimageborder';}
function clearOldVideo(xmlcount)
{ for(i=0;i<=parseInt(xmlcount);i++)
{try{document.getElementById('curvideo'+i).className='novideoimageporder';}
catch(ex)
{}}}
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];}
return false;}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];}
return a;}
this.getLength = function() { return this.keyValuePairs.length; } }
function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); }
function switchPages(){
var str=document.location.href.toLowerCase();
var  lang= str.indexOf("arabic");
if(lang < 0)
{str=str.replace("english", "arabic");
lang= str.indexOf("arabic/pages");

if(lang > 0)
{
document.location = str;
}
else{
lang= str.indexOf("forgetpasswordcontrol");
if(lang > 0)
{
document.location = str;

}
else
{
lang= str.indexOf("news/pages/searchresults");
if(lang > 0)
{
str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/newshome.aspx";

}
else
{
lang= str.indexOf("music/pages/searchresults");
if(lang > 0)
{
str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/videos.aspx";


}
else
{
	lang=str.indexOf("answercompetition.aspx");
	if(lang>0)
	{
		str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/competitionhome.aspx";

		
	}

}
 if(str.split("/")[4]!="search")
	str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4];
 

}

//str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4];



document.location = str;
}
}
}
else{str=str.replace("arabic", "english");
lang= str.indexOf("english/pages");
if(lang > 0)
{document.location = str;}
else{
lang= str.indexOf("forgetpasswordcontrol");
if(lang > 0)
{
document.location = str;
}
else
{
lang= str.indexOf("news/pages/searchresults");
if(lang > 0)
{
str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/newshome.aspx";

}
else
{
lang= str.indexOf("music/pages/searchresults");
if(lang > 0)
{
str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/videos.aspx";


}
else
{
	lang=str.indexOf("answercompetition.aspx");
	if(lang>0)
	{
		str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4]+"/"+"pages/competitionhome.aspx";

		
	}

}
if(str.split("/")[4]!="search")
	str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4];
}

//str=str.split("/")[0]+"//"+str.split("/")[1]+str.split("/")[2]+"/"+str.split("/")[3]+"/"+str.split("/")[4];
document.location = str;}}
}
}
/* News */
function MouseHover () {document.getElementById('ImageBorder').className='imageBorderColor';document.getElementById('highlightdev').style.display='Block'}
function MouseOut () {document.getElementById('ImageBorder').className='imageBorder';document.getElementById('highlightdev').style.display='none'}
/* News Listing */
function ParamNameID()
{var ParamNameID = document.getElementById('NewsType').className
if (ParamNameID == '')
{document.getElementById('TitleOfThePage').innerHTML = "Music News";}
else{var ParamNameID = document.getElementById('NewsType').className
if (ParamNameID == 'Entertainment News')
document.getElementById('TitleOfThePage').innerHTML = "Entertainment News";
if (ParamNameID == 'Music News')
document.getElementById('TitleOfThePage').innerHTML = "Music News";
if (ParamNameID == 'Music Interviews News')
document.getElementById('TitleOfThePage').innerHTML = "Music Interviews News";
if (ParamNameID == 'Prosocial News')
document.getElementById('TitleOfThePage').innerHTML = "Prosocial News";}}
function ParamNameIDAR()
{var ParamNameIDAR = document.getElementById('NewsType').className
if (ParamNameIDAR == '')
{document.getElementById('TitleOfThePage').innerHTML = "أخبار الموسيقى";}
else{
var ParamNameIDAR = document.getElementById('NewsType').className
if (ParamNameIDAR == 'Entertainment News')
document.getElementById('TitleOfThePage').innerHTML = "أخبار السينما";
if (ParamNameIDAR == 'Music News')
document.getElementById('TitleOfThePage').innerHTML = "أخبار الموسيقى";
if (ParamNameIDAR == 'Music Interviews News')
document.getElementById('TitleOfThePage').innerHTML = "	مقابلات موسيقية";
if (ParamNameIDAR == 'Prosocial News')
document.getElementById('TitleOfThePage').innerHTML = "Prosocial News";
}}
 /****** music ***/
function MouseHoverMusic (){document.getElementById('highlightdev').style.display='Block'}
function MouseOutMusic (){document.getElementById('highlightdev').style.display='none'}
function MouseHoverMusicArtist (){document.getElementById('highlightdevMusic').style.display='Block'}
function MouseOutMusicArtist (){document.getElementById('highlightdevMusic').style.display='none'}
/* Home Page */
function ProHomeHover (){document.getElementById('Prohighlightdev').style.display='Block'}
function ProHomeOut (){document.getElementById('Prohighlightdev').style.display='none'}
 /******Art ***/
function MouseHoverArt (){document.getElementById('UploadOfWeekDiv').style.display='Block';}
function MouseOutArt (){document.getElementById('UploadOfWeekDiv').style.display='none';}
function MenuSectionColor(id)
{var colorName;
if (id == 'aParentNode0'){
colorName='#fff';
document.getElementById(id).style.color = '#fff';}
else if (id == 'aParentNode1'){
document.getElementById(id).style.color = '#00fffc';
selectedAnchorMenuItemColorName= '#00fffc';
selectedDivMenuItemClassName='ChildSelected';}
//Music
if (id == 'aParentNode2'){
document.getElementById(id).style.color = '#2ccc24';
selectedAnchorMenuItemColorName= '#2ccc24';
selectedDivMenuItemClassName='ChildSelected';}
//Tv
if (id == 'aParentNode3'){
document.getElementById(id).style.color = '#ff4907';
selectedAnchorMenuItemColorName= '#ff4907';
selectedDivMenuItemClassName='ChildSelected';}
//MTVaArt
if(id == 'aParentNode4')
{document.getElementById(id).style.color = '#3374ff';
selectedAnchorMenuItemColorName= '#3374ff';
selectedDivMenuItemClassName='ChildSelected';}
//Inside MTVa
if(id == 'aParentNode5'){
document.getElementById(id).style.color = '#ffff03';
selectedAnchorMenuItemColorName= '#ffff03';
selectedDivMenuItemClassName='ChildSelected';}
//Interactive
if(id == 'aParentNode6'){
document.getElementById(id).style.color = '#e10000';
selectedAnchorMenuItemColorName= '#e10000';
selectedDivMenuItemClassName='ChildSelected';}
//Prosocial
if(id == 'aParentNode7')
{document.getElementById(id).style.color = '#c60790';
selectedAnchorMenuItemColorName= '#c60790';
selectedDivMenuItemClassName='ChildSelected';}
}
//Function for the selected child node
function MenuChildSectionColor(id)
{if(id == 'parentNode1_2')
{document.getElementById(id).style.color = '#00fffc';
document.getElementById(id).style.className = 'ChildSelected';}}
// Video Gallery 
function selectVideoGalleryItem(divName,masterGroup,unSelectedClassName,selectedClassName,selectedControlID)
  {var divControls= window.document.getElementsByTagName("div");
    if(divControls.length!=0)
    {for(var i = 0; i < divControls.length; i++) 
        {if(divControls[i].getAttribute("groupname")!=null && divControls[i].getAttribute("groupname").toLowerCase()==masterGroup.toLowerCase())
        {divControls[i].className=unSelectedClassName;divControls[i].setAttribute("selectedVideo","0");}            
        }}
    var selectdev=window.document.getElementById(selectedControlID)
	    selectdev.className=selectedClassName;  
	   selectdev.setAttribute("selectedVideo","1")}
     function onVideoGalleryItemMouseOut(controlID){
  	var divControl=window.document.getElementById(controlID);
        if(divControl.getAttribute("selectedVideo")!=null)
        {if(divControl.getAttribute("selectedVideo")=="0")
        {divControl.className="noOpacity";}
        else{divControl.className="videoimageborder";}}}
  function onVideoGalleryItemMouseOver(controlID)
  {var divControl=window.document.getElementById(controlID);
        if(divControl.getAttribute("selectedVideo")!=null)
        {if(divControl.getAttribute("selectedVideo")=="0")
        {divControl.className="Opacityr";}
        }}
function  TransMenuChildSectionColor(TagName,masterGroup,valueName,attributeKindName)
 {var divControls= window.document.getElementsByTagName(TagName);
    if(divControls.length!=0)
    {for(var i = 0; i < divControls.length; i++) 
        {if(divControls[i].getAttribute("groupName")!=null && divControls[i].getAttribute("groupName").toLowerCase()==masterGroup.toLowerCase())
            {if(divControls[i].getAttribute("selectedChild")!=null && divControls[i].getAttribute("selectedChild").toLowerCase()=='true')
                { if(attributeKindName.toLowerCase()=="classname")
                                {divControls[i].className=valueName;}
                                else
                                {divControls[i].style.color=valueName;}
                }}}}}
var currentPlayerDiv = "";
function RunAudioFlash(MovieURL,Color,ansID)
{
                try{document.getElementById('VP2').parentNode.innerHTML = "";}
                catch(ex){}
                if(document.getElementById(ansID).style.display == "none") //show player
                {
                                document.getElementById(ansID).style.display = "block";
                                RunFlash(MovieURL,Color,ansID);
                                if ( (currentPlayerDiv!="") && (currentPlayerDiv!="ansID") )
                                {
                                                document.getElementById(currentPlayerDiv).style.display = "none";
                                                document.getElementById(currentPlayerDiv).innerHTML = "";
                                }
                                currentPlayerDiv = ansID;
                }
                else
                {
                                document.getElementById(ansID).style.display = "none";
                                document.getElementById(ansID).innerHTML = "";
                }
}


/*function RunAudioFlash(MovieURL,Color,ansID){
try{document.getElementById('VP2').parentNode.innerHTML = "";}
catch(ex){}
	if(document.getElementById(ansID).style.display == "none")
		{document.getElementById(ansID).style.display = "block";
		RunFlash(MovieURL,Color,ansID);}
	else{document.getElementById(ansID).style.display = "none";
	document.getElementById(ansID).innerHTML = "";}}*/
/* Local Shows */
function OnMTvHover ()
{document.getElementById('OnMtv').className='OnMtvHover';
// document.getElementById('OnMtv').style.display= 'Block';
 }
function OnMTvOut ()
{document.getElementById('OnMtv').className='OnMtv';}
function BehindSceneHover ()
{document.getElementById('BehindScene').className='BehindSceneHover';
 //document.getElementById('BehindScene').style.display= 'Block';
 }
function BehindSceneOut ()
{document.getElementById('BehindScene').className='BehindScene';}
/* poll iframe*/
function makeIframe()
{document.getElementById('divPoolIframe').innerHTML='<iframe id="the_iframe" src="PollControl.aspx" width="270px" height="250px" scrolling="no" FRAMEBORDER="0" marginheight="0px" marginwidth="0px" ></iframe>';
try{document.getElementById("the_iframe").attachEvent('onload',afterLoadIframe)}
catch(ex){}
try{document.getElementById("the_iframe").addEventListener('load',afterLoadIframe,false)}catch(ex){}}
function afterLoadIframe()
{var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++)    {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;}
else if (dataProp)
return data[i].identity;
}},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"}
],
dataOS : [
{string: navigator.platform,
subString: "Win",
identity: "Windows"
}
]
};
BrowserDetect.init();
document.getElementById("divPoolIframe").style.display="block";
document.getElementById("divPoolIframeHover").style.display="none";
if ((BrowserDetect.browser + ' ' + BrowserDetect.version) == 'Explorer 6')
{var the_height=document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
document.getElementById('the_iframe').height=the_height;}
else
{var the_height=document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
document.getElementById('the_iframe').height=the_height;}}
/* Music Tabs*/
function ChartschideAllDiv(){document.getElementById('TopTen').style.display='none';
document.getElementById('worldChartExpress').style.display='none';
document.getElementById('HipHop').style.display='none'
document.getElementById('DanceFloorChart').style.display='none'}
function ShowTopTenChartDiv()
{document.getElementById('TopTen').style.display='block'
   document.getElementById('TopTenText').className='MusicTapBgColorNone';
   document.getElementById('TopTenREdge').className='MusicTapSeperSelectedRight';
   document.getElementById('WorldText').className='TabBg';
   document.getElementById('worldREdge').className='MusicTapSeperator';
   document.getElementById('HipText').className='TabBg';
   document.getElementById('HipREdge').className='MusicTapSeperator';
   document.getElementById('DanceText').className='TabBg';
   document.getElementById('DanceREdge').className='MusicTapLastSeperator';
   document.getElementById('Video').style.display='none'
   document.getElementById('VideoText').className='TabBg'
   document.getElementById('VideoREdge').className='MusicTapSeperator'
   document.getElementById('MusicVideoREdge').className='MusicTapSeperSelectedRight';}
function ShowWorldChartDiv()
{document.getElementById('worldChartExpress').style.display='block';
   document.getElementById('TopTenText').className='TabBg';
   document.getElementById('TopTenREdge').className='MusicTapSeperSelectedLeft';
   document.getElementById('WorldText').className='MusicTapBgColorNone';
   document.getElementById('worldREdge').className='MusicTapSeperSelectedRight';
   document.getElementById('HipText').className='TabBg';
   document.getElementById('HipREdge').className='MusicTapSeperator';
   document.getElementById('DanceText').className='TabBg';
   document.getElementById('DanceREdge').className='MusicTapLastSeperator';
   document.getElementById('Video').style.display='none'
   document.getElementById('VideoText').className='TabBg'
   document.getElementById('VideoREdge').className='MusicTapSeperSelectedLeft'
   document.getElementById('MusicVideoREdge').className='MusicTapSeperator';}
function ShowHipHopChartDiv()
{document.getElementById('HipHop').style.display='block';
   document.getElementById('TopTenText').className='TabBg';
   document.getElementById('TopTenREdge').className='MusicTapSeperator';
   document.getElementById('WorldText').className='TabBg';
   document.getElementById('worldREdge').className='MusicTapSeperSelectedLeft';
   document.getElementById('HipText').className='MusicTapBgColorNone';
   document.getElementById('HipREdge').className='MusicTapSeperSelectedRight';
   document.getElementById('DanceText').className='TabBg';
   document.getElementById('DanceREdge').className='MusicTapLastSeperator';
   document.getElementById('Video').style.display='none'
   document.getElementById('VideoText').className='TabBg'
   document.getElementById('VideoREdge').className='MusicTapSeperator'
   document.getElementById('MusicVideoREdge').className='MusicTapSeperator';}
function ShowDanceChartDiv()
{document.getElementById('DanceFloorChart').style.display='block'
   document.getElementById('TopTenText').className='TabBg';
   document.getElementById('TopTenREdge').className='MusicTapSeperator';
   document.getElementById('WorldText').className='TabBg';
   document.getElementById('worldREdge').className='MusicTapSeperator';
   document.getElementById('HipText').className='TabBg';
   document.getElementById('HipREdge').className='MusicTapSeperSelectedLeft';
   document.getElementById('DanceText').className='MusicTapBgColorNone';
   document.getElementById('DanceREdge').className='MusicTapLastSeperSelected';
   document.getElementById('Video').style.display='none'
   document.getElementById('VideoText').className='TabBg'
   document.getElementById('VideoREdge').className='MusicTapSeperator'
   document.getElementById('MusicVideoREdge').className='MusicTapSeperator';}
function ShowVideoDiv()
{document.getElementById('Video').style.display='block'
   document.getElementById('TopTenText').className='TabBg';
   document.getElementById('WorldText').className='TabBg';
   document.getElementById('worldREdge').className='MusicTapSeperator';
   document.getElementById('HipText').className='TabBg';
   document.getElementById('HipREdge').className='MusicTapSeperator';
   document.getElementById('DanceText').className='TabBg';
   document.getElementById('DanceREdge').className='MusicTapLastSeperator';
   document.getElementById('VideoText').className='MusicTapBgColorNone'
   document.getElementById('VideoREdge').className='MusicTapSeperSelectedRight'
   document.getElementById('MusicVideoREdge').className='MusicTapSeperSelectedLeft';}
function ShowDanceChartDivNew()
{document.getElementById('worldREdge').className='MusicTapSeperSelectedLeft';}
function SwitchDiv(id,hide){if(hide){document.getElementById(id).style.display='none';}else {document.getElementById(id).style.display='';}}