//var page = baseurl+'/ajax.php';
	function JSetcookie(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};



	function ToggleView(obj) {
			var obj = $jQuery(obj),
			obj_id = obj.attr('id'),
			parent = obj.parent().attr('id'),
			target = $jQuery('#VDO_CONTAINER01').attr('id');
			if(obj_id == "grid") {
			$jQuery('#'+target+' .horizantal').addClass('vertical');
			$jQuery('#'+target+' .vertical').removeClass('horizantal');
			JSetcookie("current_style","grid_view");
			} else {
			$jQuery('#'+target+' .vertical').addClass('horizantal');
			$jQuery('#'+target+' .horizantal').removeClass('vertical');
			JSetcookie("current_style","list_view") ;
			}
			}; 


	function GetParam( name )
	{
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null )
		return "";
	  else
		return results[1];
	}


	function Confirm_Delete(delUrl) {
	  if (confirm("Are you sure you want to delete")) {
		document.location = delUrl;
	  }
	}

	function Confirm_DelVid(delUrl) {
	  if (confirm("Are you sure you want to delete this video?")) {
		document.location = delUrl;
	  }
	}

	
	function removeVideo(formname)
	{
		if (confirm('Are you sure you want to remove this video?'))
		{
			document.formname.submit();
		}
	}

	

	function reloadImage(captcha_src)
	{
	img = document.getElementById('captcha');
	img.src = captcha_src+'?'+Math.random();
	}

	

	//Is Used to Validate Form Fields

	function validate_required(field,alerttxt)
	{
	with (field)
	{
	  if (value==null||value=="")
 	 {
 	 alert(alerttxt);return false;
 	 }
 	 else
 	 {
	  return true;
	  }
	}
	}
	

	//Validate the Upload Form

	function validate_upload_form(thisform)

	{

	with (thisform)

	{

			if (validate_required(title,"Title must be filled out!")==false)

 	 		{

		 title.focus();return false;

			}

			if (validate_required(description,"Description must be filled out!")==false)

 			{

		 description.focus();return false;

			}

			if (validate_required(tags,"Plase Enter some tags for video")==false)

 			{

		 tags.focus();return false;

			}

			if (validate_required(category[0],"Select Category")==false)

 			{

		 	}

	

	}

	}

	

	//Validate the Add Category Form

	function validate_category_form(thisform)

	{

	with (thisform)

	{

			if (validate_required(title,"Title must be filled out!")==false)

 	 		{

		 title.focus();return false;

			}

			if (validate_required(description,"Description must be filled out!")==false)

 			{

		 description.focus();return false;

			}

	

	}

	}

	

	//Validate the Add Advertisment Form

	function validate_ad_form(thisform)

	{

	with (thisform)

	{

			if (validate_required(name,"Name must be filled out!")==false)

 	 		{

		 name.focus();return false;

			}

			if (validate_required(type,"Type must be filled out!")==false)

 			{

		 type.focus();return false;

			}

			if (validate_required(syntax,"Syntax Must Be Filled Out")==false)

 			{

		 syntax.focus();return false;

			}

			if (validate_required(code,"Code Must Be Filled Out")==false)

 			{

		 code.focus();return false;

			}

	}

	}

	

	

	//CHECKK ALL FUNCTIOn



		<!--

		function checkAll(wotForm,wotState) {

			for (a=0; a<wotForm.elements.length; a++) {

				if (wotForm.elements[a].id.indexOf("delete_") == 0) {

					wotForm.elements[a].checked = wotState ;

				}

			}

		}

		// -->



	function hide_active_sharing() {

	  hideDiv("flash_recent_videos");

	}

	

	function hideDiv(divname) {

	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById(divname).style.visibility = 'hidden';
	//.style.display = 'block';
	document.getElementById(divname).style.display = 'none';
	}

	else {

	if (document.layers) { // Netscape 4
	document.divname.visibility = 'hidden';
	document.divname.display = 'none';

	}

	else { // IE 4
	document.all.divname.style.visibility = 'hidden';
	document.all.divname.style.display = 'none';
	}
	}
	}

	function showDiv(divname) {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById(divname).style.visibility = 'visible';
	document.getElementById(divname).style.display = 'block';
	}
	else {
	if (document.layers) { // Netscape 4
	document.divname.visibility = 'visible';
	document.divname.display = 'block';
	}
	else { // IE 4
	document.all.divname.style.visibility = 'visible';
	document.all.divname.style.display = 'block';
	}
	}
	}
	var OnId =null;

	function SetId(ID){
 		if(OnId != null){
		OldElement = document.getElementById(OnId);
		OldElement.setAttribute("class", ''); //For Most Browsers
		OldElement.setAttribute("className", ''); //For Most Browsers
		}

		element = document.getElementById(ID);
		if(element !=null){
		element.setAttribute("class", 'currentTab'); //For Most Browsers
		element.setAttribute("className", 'currentTab'); //For Most Browsers
		OnId = ID;
		}
	}

	function innerHtmlDiv(Div,HTML){
		document.getElementById(Div).innerHTML=HTML;
	}

