var clk='t0';// which tab is clicked + on open which one is selected

function setC(){
// function to set selected tab red on open and static tab to "open"


changetab(); // to set static tab onload

}


function toggleTab(whchTab)
{

// generic function to change display status to tabs and amimated divs
var style2 = document.getElementById(whchTab).style;
var what = style2.display;
style2.display = (what=="block") ? "":"block"; // show content tab

}


// static tab code


var stab='tab10'; // reference to tab content
var ali='t10'; // to keep track which <a> background to change

var flag=0;  //counter - 0 closed, 1 opened
var tabNo;

function changetab(){

var li = document.getElementById(ali).style; // to change colour on the tab!
toggleTab(stab);
flag = (flag == 0) ? 1 : 0; //this one on close + change flag to 0
li.background = (flag==1) ? "white":"blue url(images/blue.gif)";
li.color=  (flag==1) ? "red":"white";

}



function chngS(wchtab){

changetab();
tabNo=wchtab;

switch(tabNo){
case 10: stab='tab10'; ali='t10'; break;
case 11: stab='tab11'; ali='t11'; break;
case 12: stab='tab12'; ali='t12'; break;
}



changetab();
/*
if(stab=='tab10'){

//run some code?


}

if(stab=='tab11'){

//run some code?

}

*/

}


//================= load functions start here==========



function load() {

setC(); // to  set first static tab to open

}


/* ======= generic functions for search input ============ */


/*clears text initially in input field*/


function clearDefaultandCSS(el) {
    if (el.defaultValue==el.value) el.value = "";
    if (el.style) el.style.cssText = "";
}



/*submits on"enter" button*/


function submitenter(myfield,e)
{


var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   startytsearch();
   return false;
   }
else
   return true;
}


/*===== detach function ====*/

function detachPL() {

if ( ytp.plaerLoad == 1) {
    stop();
}
var iWidth=700;
var iHeight=335;
var iLeft=(screen.width-iWidth)/2;
var iTop=(screen.height-iHeight)/2;

var geturl = ytp.YTP_URL + ytp.nowDisplayUrl; //encodeURIComponent
//adderr(geturl);

newwindow=window.open(geturl,'Player','width='+iWidth+', height='+iHeight+', top='+iTop+', left='+iLeft+',toolbar=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=no,modal=no');


}


