function goToURL(obj) {
    var i = obj.selectedIndex;
    if(i>0){
        if(obj.options[i].value.indexOf('http://')==-1)
            window.open('http://' + obj.options[i].value);
        else
            window.open(obj.options[i].value);
    }
}
function get_active_menu(mnu_link_arr,mnu_id_arr){
    var url=self.location.href.toLowerCase();
    for(var i=0;i<mnu_link_arr.length;i++){
        if(url.indexOf(mnu_link_arr[i])>-1){
            document.getElementById(mnu_id_arr[i]).className="current";
            break;
        }
    }
}
function checksearch()
{
    if(jQuery("#keyword").val()=="" || jQuery("#keyword").val()==searchStr)
    {
        alert(searchStr);
        jQuery("#keyword").focus();
        return false;
    }
    return true;
}
function doSearch()
{
    if(!checksearch())
        return;
    jQuery('#Submit').val('OK');
    jQuery('#frmSearch').submit();
}
function addToCart(contentID,contentUrl){
    self.location.href= indexPathPrefix + '?mod=basket&action=add&item='+contentID+"&return="+contentUrl;
}
function doDelete(id){
    if(confirm(deleteConfirmMessage)){
        self.location.href = indexPathPrefix + '?mod=basket&action=remove&item='+id
    }
}
function gup(myUrl,name)
{
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec(myUrl);
    if( results == null )
        return "";
    else
        return results[1];
}
function doContinue(){
    var myReturn = gup(self.location.href,'return');
    if(myReturn != ''){
        var cid = gup(self.location.href,'cid');
        self.location.href = myReturn + (cid == '' ? '' : '&cid=' + cid);
    }else{
        self.location.href = indexPathPrefix +'?mod=product';
    }
}
function doClear(){
    if(confirm(deleteConfirmMessage)){
        self.location.href = indexPathPrefix + '?mod=basket&action=clear';
    }
}
function doCheckOut(){
    self.location.href = indexPathPrefix + '?mod=bill';
}
// Function WriteSwf
function WriteSwf(img,wsize,hsize){
    document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
    document.write("<param name=\"movie\" value=\""+img+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=wmode value=transparent>");
	document.write("<param name=\"menu\" value=\"false\">");
    document.write("<embed src=\""+img+"\" wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\" menu=\"false\"></embed>");
	document.write("</object>");
}
//
function setCookie(c_name,value,exdays)
{
	var exdate=new Date();
	exdate.setTime(exdate.getTime() + 1000 * 60 * exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name)
	    {
	    return unescape(y);
	    }
	  }
}
function isEnablePopup(){
	if(getCookie("kim_tin_new_pop_up") != null){
		return false;
	}
	return true;
}
function writePopupCookie(){
	setCookie("kim_tin_new_pop_up", 'disable_pop_up_equal_true', 3);
}
