//## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  SITE CONFIGURATIN !!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// DB initialization 
var dbArray = new Array();
var dbreport;
var recordcount;
var coloumcount;

// Ajax initialization 
	var cp = new cpaint();
	cp.set_debug(false);			
	cp.set_response_type('XML');	

//##!!!!!!!!!!!!!!!!!!!!!!!!!!   My FUNCTION ARCHIVE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

// !!!!!!  SHOW HIDE Index: 1-15-2011

$(function() {
  
   $("a#showthisIndex").click(function() {
      $("a#showthisIndex").hide();
      $("a#hidethisIndex").css("display", "inline");
      $("div#headerfix").slideDown('slow');
      $("div#headnav").slideDown('slow');
      $("div#lowercontainer").show(); 
      $("div#topfootercontainer").show();
      $("div#advertnav").css("margin", "-20px 0 0 0");        
   });
   $("a#hidethisIndex").click(function() {
      $("a#hidethisIndex").hide();
      $("a#showthisIndex").css("display", "inline");
      $("div#headerfix").animate({ height: 'hide', opacity: 'hide' }, 'slow');
      $("div#headnav").slideUp({ height: 'hide', opacity: 'hide' }, 'slow');
      $("div#lowercontainer").hide();  
      $("div#topfootercontainer").hide(); 
      $("div#advertnav").css("margin", "0 0 0 0"); 
   });
   
   $("a#showthisVideo").click(function() {
      $("a#showthisVideo").hide();
      $("a#hidethisVideo").css("display", "inline");
      $("div#viewvideo-captionhelp").slideDown('slow');
      $("div#viewvideo-captionwindow").slideDown('slow');
   });
   $("a#hidethisVideo").click(function() {
      $("a#hidethisVideo").hide();
      $("a#showthisVideo").css("display", "inline");
      $("div#viewvideo-captionhelp").slideUp({ height: 'hide', opacity: 'hide' }, 'slow');
      $("div#viewvideo-captionwindow").slideUp({ height: 'hide', opacity: 'hide' }, 'slow');       
   });
   
   $("input#showthisAdminVideo").click(function() {
      $("input#showthisAdminVideo").hide();
      $("input#hidethisAdminVideo").css("display", "inline");
      $("div#rightplayertester").slideDown('slow');
   });
   $("input#hidethisAdminVideo").click(function() {
      $("input#hidethisAdminVideo").hide();
      $("input#showthisAdminVideo").css("display", "inline");
      $("div#rightplayertester").slideUp({ height: 'hide', opacity: 'hide' }, 'slow');
   });
   
   
   $("#elanguage").change(function() {
      $('input#title').translate('en', $("#elanguage").val(), {
      complete: function(translation){ console.log(translation); }  
      });
      $('textarea#description').translate('en', $("#elanguage").val(), {
      complete: function(translation){ console.log(translation); }  
      });
      $('textarea#keyword').translate('en', $("#elanguage").val(), {
      complete: function(translation){ console.log(translation); }  
      });
   });
    
   $("#tlanguage").change(function() {
      $('input#title').translate($("#tlanguage").val(), 'en', {
      complete: function(translation){ console.log(translation); }  
      });
      $('textarea#description').translate($("#tlanguage").val(), 'en', {
      complete: function(translation){ console.log(translation); }  
      });
      $('textarea#keyword').translate($("#tlanguage").val(), 'en', {
      complete: function(translation){ console.log(translation); }  
      });
   });
      
 });

// END 
// !!!!!!  SHOW HIDE

function setVisibility(id, visibility) {
  document.getElementById(id).style.display = visibility;
  }
function setAlignment(id, thealigment) {
  document.getElementById(id).style.margin = thealigment;
  }

// END 

//!!!!!!!!! Executer Databse

var dbLloaded=true;

function executeDB(sql){
		var processScriptUrl=baseurl+'ajax/myphpajax.php';
		cp.call(processScriptUrl,'executeDB',return_value,sql);
	
}
	
function return_value(result){
				
		dbreport=result.getElementsByTagName('dbreport').item(0).firstChild.data;
		
		if (dbreport=='1'){
			// GET How many row fetch
			recordcount=result.getElementsByTagName('recordcount').item(0).firstChild.data;
			coloumcount=result.getElementsByTagName('coloumcount').item(0).firstChild.data;

			//Population My DB Values							
				for( i=0;i<recordcount;i++){
					dbArray[i]=new Array(recordcount);
					for( ii=0;ii<coloumcount;ii++){
						dbArray[i][ii]=result.getElementsByTagName('dbvalue'+i+ii).item(0).firstChild.data;															
					}
				}
				
				
		}


dbLoaded = false;
							
															
}
//END 

//!!!!!!!Insert data in to  table HTML patge

	function insertInToTable(tblId, varRow, varCell, varData){
		try{
			var x=document.getElementById(tblId).rows[varRow].cells;
			x[varCell].innerHTML=varData;
			return false;
		}
		catch(Err){
			return false;
		}
	}

//END 



// !!!!!! Input validation empty

	function txtBoxValidation(myId,defaultColor,errColor){
		
		// # My property
		try{	
			me=document.getElementById(myId);

			if(me.value==""){	
				me.style.background=errColor;
				me.setFocus;
				return false;
			}
			else{
				me.style.background=defaultColor;
				me.setFocus;
				return true;
			}
		}
		catch(Err){
			return 'Err';
		}
	}

// END 
 
  
// !!!! !!HIEKE A OBJECT //
function hideMe(myId){
	document.getElementById(myId).style.display="none";
	
}
// END

// !!!!!! TO SHOW A OBJECT 
function showMe(myId){
	document.getElementById(myId).style.display="block";
	
}
//END 




// !!!!!!  ASSIGN VALUE IN TO A OBJECT

function directMyvalueto(myValue,thatId){
	document.getElementById(thatId).value=myValue;
}
// END 


// !!!!!!  CHANGE VALUE OF TEXTAREA FOR EMBED

function radCheck(){
var l=document.linkForm.radOne.length;
for(var i=0;i<l;i++){
if(document.linkForm.radOne[i].checked)document.linkForm.video_play.value=document.linkForm.radOne[i].value;
}
}
// END 

// !!!!!!  SHOW HIDE ALPHA

function showonlyone(thechosenone) {
      var alpha = document.getElementsByTagName("div");
            for(var x=0; x<alpha.length; x++) {
                  name = alpha[x].getAttribute("name");
                  if (name == 'alpha') {
                        if (alpha[x].id == thechosenone) {
                        alpha[x].style.display = 'block';
                  }
                  else {
                        alpha[x].style.display = 'none';
                  }
            }
      }
}
// END 


(function() {
var version = flashembed.getVersion();
var supported = flashembed.isSupported([9, 115]);
if(supported) {
		document.cookie = 'flashplayerstatus=true; expires=Thu, 2 Aug 2015 20:47:11 UTC; path=/;'
}else{
		document.cookie = 'flashplayerstatus=false; expires=Thu, 2 Aug 2015 20:47:11 UTC; path=/;'
}
})()
;
